Conversation
|
@sipsma Locally I'm repeatedly getting errors like Not exactly sure in what case it appears. |
|
In output one weird case is that commands can appear out of order. Also need some way to remove the status lines for merges from output(ideally combine with copy lines). |
c8b69b0 to
a9e54f2
Compare
This is mostly just preparation for merge-op. The lowercase "extract" method is replaced with a more general "prepareMounts" method which does all the work necessary to make a cache record mountable and then caches the mountable object, ready to use whenever Mounts is called in the future. It centralizes more of the logic around setting up these mounts, which will make the merge-op handling code a bit more tractable. Signed-off-by: Erik Sipsma <erik@sipsma.dev>
Parent was only used in two places externally where it could easily be removed or replaced by other existing methods. Not having to support external access to Parent refs simplifies forthcoming merge-op support. Signed-off-by: Erik Sipsma <erik@sipsma.dev>
This allows the overlay diff logic to be re-used by the snapshot package as part of merge+diff op. Signed-off-by: Erik Sipsma <erik@sipsma.dev>
Before this, descriptor handlers were not included with calls to the exporter, which then sometimes called LoadRef and failed to get a ref because it was lazy. This change results in the DescHandlers of the already loaded refs to get plugged into context so they can be re-used by the exporter if it needs to load the ref again. Signed-off-by: Erik Sipsma <erik@sipsma.dev>
This consists of just the base MergeOp with support for merging LLB results that include deletions using hardlinks as the efficient path and copies as fallback. Signed-off-by: Erik Sipsma <erik@sipsma.dev>
Updated my PR with what should be a fix for that. That case could happen when a merge ref got EDIT: removed above should have been released
Will take a look at these |
For clarity, I never ran prune when I tested this so these releases must have been automatic. |
Yeah exactly, I just didn't have a test case yet where I ran two builds with the exact same merge (there was always a change to merges between builds in my tests), which is what caused this. |
|
@sipsma But is it correct that the merge snapshot should be released as soon as ref is released? Shouldn't it be released by prune(or buildkit gc). |
That's what I'm saying, the behavior is that the snapshots are not released when the ref count goes to 0. However, before my fix, when a new ref got created for the merge again it was incorrectly assuming that its snapshot was always gone. After my fix, it doesn't assume snapshot is gone anymore and instead handles both cases of 1) it still existing and 2) it having been pruned and needing to be recreated |
|
When the build is complete is the merge ref visible in
I get that but should the ref itself be released when ref count goes to 0. |
It should be as I updated the usage code, but I haven't specifically tried w/ buildctl yet. I'll give that a try manually to be 100% sure. Will add some test coverage to client_test.go for this too (unless there's a better place for it).
Yes. Obviously if the user called Prune and the snapshot got removed you'd have to remake the merge snapshot but as long as it wasn't manually pruned you will re-use the hardlink-copy snapshot from before. That's the bug you ran into, it was seeing that the snapshot already existed and can be re-used, but the code was only checking
The behavior here is the same as before merge-op. Release gets called on the ref, ref count goes to 0 but the actual cacheRecord and snapshot continue to exist unless a prune occurs on them. In my earlier comment I said "That case could happen when a merge ref got removed" which maybe is causing the confusion, it would have been more clear to say "That case could happen when a merge ref got released". No behavior changed in terms releasing refs/cacheRecords. |
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
a9e54f2 to
0d80bc2
Compare
|
@tonistiigi Confirmed that The parents show up as the input ref IDs separated by I also double checked and confirmed that re-running the same builds results in the merge refs getting re-used rather than recreated. I'm still looking into the progress output appearing out of order as you mentioned earlier, will let you know what I find. |
The output is expected as |
|
Just saw you pushed the update and was looking through the remaining test failures. Ignoring the chown-related ones which are expected for now, one significant one seems to be Trying to think through how we can deal with this... Using the test case as an example, do you think it's possible to set up a conditional dependency between the vertex for If we can do that, then we'll still get caching benefits when If that actually is possible, I'm wondering if we can use the same approach for |
|
I don't see any solutions for this :( The test uses The only options are Dockerfile v2 with updated |
|
Yeah I see your point. In terms of the fallback options, I personally wouldn't mind something like That's still not nearly as nice as getting everyone improvements with literally zero effort but personally as a user I wouldn't be bothered by getting a potentially large performance improvement from just adding a single line to my Dockerfile. |
|
replaced by #2596 |
Testing how much #2335 breaks before #2414