Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DiffOp Preparation Commits #2517

Merged
merged 3 commits into from
Dec 10, 2021
Merged

DiffOp Preparation Commits #2517

merged 3 commits into from
Dec 10, 2021

Conversation

sipsma
Copy link
Collaborator

@sipsma sipsma commented Dec 10, 2021

These are the initial commits of #2434 split out as suggested in that PR. @tonistiigi responded and updated from your comments about these commits in that PR, let me know if you'd prefer there be one PR-per-commit rather than grouping them here.

Using an interface instead of a func is more flexible while achieving
the same effect. It allows you to succintly define a large number of
test cases as structs, as is common in table-driven testing.

A helper func is added that converts the existing test funcs into the
interface, so the change is fairly seamless.

Signed-off-by: Erik Sipsma <[email protected]>
Before this change, test cases were running with an env var that forces
the overlay differ to be on even when the native snapshotter was being
used, which resulted in failures. Now, that env var is skipped when
using the native snapshotter.

Additionally, this includes a related change to skip even trying to use
the overlay differ when the native snapshotter is in use. Previously,
the blob creation code first tried to use the overlay differ and then
failed and fell back to the double-walking differ. Now, it just jumps
right to the double-walking differ when the native snapshotter is in
use.

Signed-off-by: Erik Sipsma <[email protected]>
This breaks the giant blob that was the diffApply function into two
separate parts, a differ and an applier, which results in more modular
code that should be easier to follow and easier to make any future
updates to. For example, if we want to optimize by allowing differ and
applier to run in parallel in the future, that's straightforward now.

There are also some fixes that weren't needed for MergeOp, but will be
for DiffOp, such as correctly handling the case where a deletion is
applied that is under parent directories which don't exist yet (the
correct behavior is, surprisingly, to create the parent directories as
that is what the image import/export code ends up doing).

Signed-off-by: Erik Sipsma <[email protected]>
upperView, err := upperMnter.Mount()
if err != nil {
return err
type applier struct {
Copy link
Member

Choose a reason for hiding this comment

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

As commented in earlier PR I think this would be better as a separate pkg in some follow up that would hopefully lead to deduplication between this and similar tar implementations in containerd.

@tonistiigi tonistiigi merged commit ccd6964 into moby:master Dec 10, 2021
@sipsma sipsma deleted the diffop-prep branch December 10, 2021 18:51
@crazy-max crazy-max added this to the v0.10.0 milestone Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants