Skip to content

Propagate parent chain ID and diff ID via labels during snapshot preparation#13071

Merged
samuelkarp merged 1 commit intocontainerd:mainfrom
HASidd:labels-parent
Mar 23, 2026
Merged

Propagate parent chain ID and diff ID via labels during snapshot preparation#13071
samuelkarp merged 1 commit intocontainerd:mainfrom
HASidd:labels-parent

Conversation

@HASidd
Copy link
Copy Markdown
Contributor

@HASidd HASidd commented Mar 19, 2026

Implement #13070.

@github-project-automation github-project-automation Bot moved this to Needs Triage in Pull Request Review Mar 19, 2026
@dosubot dosubot Bot added the area/distribution Image Distribution label Mar 19, 2026
@HASidd HASidd force-pushed the labels-parent branch 2 times, most recently from 6a78431 to 5849afa Compare March 19, 2026 22:16
@samuelkarp samuelkarp added the area/snapshotters Snapshotters label Mar 19, 2026
samuelkarp
samuelkarp previously approved these changes Mar 19, 2026
@HASidd HASidd force-pushed the labels-parent branch 2 times, most recently from faf0d68 to 4a55c1f Compare March 19, 2026 22:30
Comment thread core/unpack/unpacker.go Outdated
labelSnapshotRef = "containerd.io/snapshot.ref"
unpackSpanPrefix = "pkg.unpack.unpacker"
labelSnapshotRef = "containerd.io/snapshot.ref"
labelSnapshotParent = "containerd.io/snapshot/parent"
Copy link
Copy Markdown
Member

@hsiangkao hsiangkao Mar 20, 2026

Choose a reason for hiding this comment

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

Is it possible to pass down the final chain ID to the snapshotters too? so that the EROFS snapshotter can leverage it to generate fsmeta if fsmerge is on in advance too (in the image unpack process) rather than prepare active snapshot when launching a container. cc @dmcgowan @fuweid

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

How does the new commit look?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

pretty nice, thanks!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What do you mean by the final chain ID? You have the parent chain ID, the diff ID of the layer, and the chain ID of the layer itself. If you're looking for children, that can change since a single parent layer can easily have multiple children. So recording "a" final chain ID might be true for one unpack and immediately false for the next one. Am I understanding correctly?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What do you mean by the final chain ID? You have the parent chain ID, the diff ID of the layer, and the chain ID of the layer itself. If you're looking for children, that can change since a single parent layer can easily have multiple children. So recording "a" final chain ID might be true for one unpack and immediately false for the next one. Am I understanding correctly?

I know one layer can still have children if this image is used as the base image.

here labelSnapshotRootfsChainID just means the recoded chain ID belonging to a final layer of some real container image so that we don't need to generate fsmerge image for every snapshot. yes, it can still be a middle layer of another container image, but it doesn't matter since another container image will have its own labelSnapshotRootfsChainID layer and fsmerge too.

The whole point is to identify the special layers so that we only need to generate fsmerge for these layers rather than every snapshot, it's waste of CPU time and do harm to the performance.

Copy link
Copy Markdown
Member

@hsiangkao hsiangkao Mar 21, 2026

Choose a reason for hiding this comment

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

Anyway it's just an idea for better EROFS fsmerge generation performance so that we don't need to strictly generate fsmerge when launching the container instead (we really need to know the special layers which are the final layer of container images)
If it sounds unclean, I'm fine to drop, but I hope there could be alternative way for this (Although I think labels are the only way to pass down information from unpacker to the snapshotter).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I reverted the changes for labelSnapshotRootfsChainID to unblock the other changes. Let me know if this is okay.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I reverted the changes for labelSnapshotRootfsChainID to unblock the other changes. Let me know if this is okay.

I'm fine with that, but I don't get some response from @samuelkarp and other folks. I still wonder what's wrong with that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm fine with that, but I don't get some response from @samuelkarp and other folks. I still wonder what's wrong with that.

Time zones and weekends.

The whole point is to identify the special layers so that we only need to generate fsmerge for these layers rather than every snapshot, it's waste of CPU time and do harm to the performance.

Does this mean you're just looking for "is this layer a top layer"? I think that'd be a more reasonable thing to add than recording a final chain ID for an intermediate snapshot (where there can easily end up being multiple final chain IDs because of inheritance).

But I think we should do that in a separate PR from this one.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm fine with that, but I don't get some response from @samuelkarp and other folks. I still wonder what's wrong with that.

Time zones and weekends.

Yeah, sorry about that.

The whole point is to identify the special layers so that we only need to generate fsmerge for these layers rather than every snapshot, it's waste of CPU time and do harm to the performance.

Does this mean you're just looking for "is this layer a top layer"? I think that'd be a more reasonable thing to add than recording a final chain ID for an intermediate snapshot (where there can easily end up being multiple final chain IDs because of inheritance).

But I think we should do that in a separate PR from this one.

ok, I think "is this layer a top layer" as a boolean value is cleaner too, I will try in this way instead, thanks.

@github-project-automation github-project-automation Bot moved this from Needs Triage to Review In Progress in Pull Request Review Mar 20, 2026
@samuelkarp samuelkarp dismissed their stale review March 20, 2026 20:14

Concern about last change.

Signed-off-by: Hasan Siddiqui <hasiddiqui@google.com>
@samuelkarp samuelkarp enabled auto-merge March 23, 2026 17:53
@samuelkarp
Copy link
Copy Markdown
Member

/retest

@samuelkarp samuelkarp added this pull request to the merge queue Mar 23, 2026
Merged via the queue into containerd:main with commit ed1536a Mar 23, 2026
132 of 138 checks passed
@github-project-automation github-project-automation Bot moved this from Review In Progress to Done in Pull Request Review Mar 23, 2026
@samuelkarp samuelkarp added impact/changelog and removed area/distribution Image Distribution labels Mar 23, 2026
@samuelkarp samuelkarp added this to the 2.3 milestone Mar 23, 2026
@samuelkarp samuelkarp changed the title Propagate diff ID and parent chain ID via labels in Prepare RPC Propagate parent chain ID and diff ID via labels during snapshot preparation Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants