Skip to content

Conversation

@dmcgowan
Copy link
Member

@dmcgowan dmcgowan commented Jul 1, 2021

Removes the snapshot event publishing from the snapshot service.

Cleans up metadata plugin registration into separate packages.

Adds an option to metadata db to add a publisher. Adds event
publishing to prepare, commit, and remove snapshot operations.
Adds remove snapshot event to garbage collection.

Adds snapshotter field to snapshot events


This is useful for snapshot caches which attempt to track current snapshots based on creation and deletion events. Most snapshots are not removed through the API, but through garbage collection. The end goal being the removal of the inefficient snapshot syncer in the CRI plugin

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 1, 2021

Build succeeded.

@dmcgowan dmcgowan force-pushed the metadata-snapshot-publish branch from cf72139 to 0ebe085 Compare July 1, 2021 20:53
@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 1, 2021

Build succeeded.

@dmcgowan dmcgowan force-pushed the metadata-snapshot-publish branch from 0ebe085 to 83ca7a7 Compare July 1, 2021 20:59
@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 1, 2021

Build succeeded.

Copy link
Member

@ktock ktock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we have 3 and 4 before?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fields only need to be unique and anything in the 1-15 range encodes to the same size. Since it is common across all the events, I choose a number higher than what any use so that it can be common and leave 1-4 reserved for event-specific fields. I am not a protobuf expert so I could be running afoul of some conventions here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Sounds good to me. I'm not a protobuf expert though :)

@mxpv
Copy link
Member

mxpv commented Jul 2, 2021

Metadata package is growing in complexity, I'd try to avoid adding new responsibilities to it and have it just manage database.
Would it be feasible to make GC reroute clean up calls through services instead of removing them directly from database? This way each service will be able to publish events or whatever logic it does.
For instance, each participating service may implement interface:

type GarbageCollect interface { Cleanup([]gc.Node) error; }

Would this make sense?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, we can move the content plugin init out of services package.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, any plugin which isn't dynamically created via configuration should be moved out

@fuweid
Copy link
Member

fuweid commented Jul 3, 2021

/cc

@k8s-ci-robot k8s-ci-robot requested a review from fuweid July 3, 2021 09:36
@dmcgowan
Copy link
Member Author

For instance, each participating service may implement interface:
type GarbageCollect interface { Cleanup([]gc.Node) error; }
Would this make sense?

The metadata package sits on the bottom of the service stack and provides the implementation used by the services. The services could register GC callbacks to handle events triggered by GC, however, that adds complexity to to the service implementations and relationship between the packages. The event publishing as it exists today is even lower level as it is built directly into the plugin framework. It seems appropriate to do event publishing at the lowest level of the service stack from my perspective so we don't miss out on events when service logic is changed or added.

I understand the concern about a single package growing in complexity compared to the complexity of other packages. My opinion is it is better to hide complexity in fewer packages rather than add complexity to the interfaces between them. We could always refactor the metadata package to separate the individual service interface implementations though. I would ideally like the metadata package not visible as a plugin but rather as those individual implementations. Right now it does contain quite a bit of the service logic, data persistence, and garbage collection. I think it would be quite a bit of effort to cleanly separate those 3 logical layers without performance degradation or increasing complexity even more.

@dmcgowan dmcgowan force-pushed the metadata-snapshot-publish branch 2 times, most recently from b91a011 to ff0c675 Compare July 27, 2021 01:08
@dmcgowan dmcgowan added this to the 1.6 milestone Oct 6, 2021
@kzys
Copy link
Member

kzys commented Oct 7, 2021

Moving to "Needs Contributor Update" due to code conflicts.

case *eventstypes.SnapshotRemove:
topic = "/snapshot/remove"
default:
log.G(ctx).WithField("event", ne.event).Debug("unhandled event type from garbage collection removal")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"garbage collection removal"?

@dmcgowan dmcgowan force-pushed the metadata-snapshot-publish branch from ff0c675 to 97e9a16 Compare December 1, 2021 02:21
@theopenlab-ci
Copy link

theopenlab-ci bot commented Dec 1, 2021

Build succeeded.

@dmcgowan dmcgowan force-pushed the metadata-snapshot-publish branch from 97e9a16 to 37cd85b Compare December 9, 2021 21:46
@theopenlab-ci
Copy link

theopenlab-ci bot commented Dec 9, 2021

Build succeeded.

@dmcgowan dmcgowan force-pushed the metadata-snapshot-publish branch from 37cd85b to a0d862e Compare December 15, 2021 20:06
@theopenlab-ci
Copy link

theopenlab-ci bot commented Dec 15, 2021

Build succeeded.

@dmcgowan
Copy link
Member Author

This has been rebased is ready for review again

Copy link
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sbuckfelder
Copy link

@kzys are you still requesting a change? Can this be rebased?

@AkihiroSuda
Copy link
Member

Needs rebase

Removes the snapshot event publishing from the snapshot service.

Adds an option to metadata db to add a publisher. Adds event
publishing to prepare, commit, and remove snapshot operations.
Adds remove snapshot event to garbage collection.

Signed-off-by: Derek McGowan <[email protected]>
@dmcgowan dmcgowan force-pushed the metadata-snapshot-publish branch from a0d862e to 2c573de Compare December 20, 2022 01:07
@dmcgowan
Copy link
Member Author

Updated, this PR is much simpler and smaller in scope now that the other changes have been split off and already merged.

@dmcgowan dmcgowan requested a review from kzys December 20, 2022 19:48
@fuweid fuweid merged commit 9a7c264 into containerd:main Jan 3, 2023
@dmcgowan dmcgowan deleted the metadata-snapshot-publish branch April 20, 2024 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

7 participants