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

solver: implement content based cache support #91

Merged
merged 1 commit into from
Aug 4, 2017

Conversation

tonistiigi
Copy link
Member

fixes #86
fixes #58
fixes #35

This needed quite a big refactoring of the solver. Not fully convinced there isn't a better abstraction for this but all others I tried had even worse issues. It is important that once the content based hit is determined, the matched node itself doesn't need to exist in the cache if there is some top level node that has cache instead. This will let us do remote backend for the instruction cache and pull in as little data as possible on cache import.

@AkihiroSuda

Signed-off-by: Tonis Tiigi [email protected]

@@ -92,7 +92,7 @@ func TestChecksumBasicFile(t *testing.T) {
dgst, err = cc.Checksum(context.TODO(), ref, "/")
assert.NoError(t, err)

assert.Equal(t, digest.Digest("sha256:0d87c8c2a606f961483cd4c5dc0350a4136a299b4066eea4a969d6ed756614cd"), dgst)
assert.Equal(t, digest.Digest("sha256:7378af5287e8b417b6cbc63154d300e130983bfc645e35e86fdadf6f5060468a"), dgst)
Copy link
Member Author

Choose a reason for hiding this comment

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

Because of a seeker bug, record for foo was missing from this hash.

Copy link
Member

Choose a reason for hiding this comment

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

Do you plan to fix the seeker bug in this PR or a separate PR?

Copy link
Member Author

@tonistiigi tonistiigi Aug 4, 2017

Choose a reason for hiding this comment

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

The bug was in contenthash pkg and is in fixed in this PR. The digest changed because the previous digest was wrong. I misunderstood what the SeekPrefix function did in iradix package and the output of the function could not be used for walking through directory items.

github.com/hashicorp/go-immutable-radix 826af9ccf0feeee615d546d69b11f8e98da8c8f1 git://github.com/tonistiigi/go-immutable-radix.git
Copy link
Member

Choose a reason for hiding this comment

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

Do you plan to propose tonistiigi/go-immutable-radix@826af9c to the upstream?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure. Another possibility would be to search for some other library. I haven't benchmarked if radix tree is optimal for this case.

@AkihiroSuda AkihiroSuda mentioned this pull request Aug 4, 2017
@AkihiroSuda
Copy link
Member

Please rebase to make sure Windows binaries can be compiled on CI?
LGTM if green.

@tonistiigi
Copy link
Member Author

Rebased, green, merging

@tonistiigi tonistiigi merged commit 40d15aa into moby:master Aug 4, 2017
alexcb pushed a commit to alexcb/buildkit that referenced this pull request Aug 18, 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
2 participants