-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Add parallel unpack support #12332
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
Add parallel unpack support #12332
Conversation
1a777f2 to
7b5fd4f
Compare
7b5fd4f to
7f78056
Compare
|
This would need to be handled in the proxied snapshotters as well, in |
7f78056 to
70737f4
Compare
70737f4 to
4ccc52f
Compare
e885452 to
50b6dea
Compare
dmcgowan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One little change, I still want to take another look through the unpack code, it was dense before and probably more so now. The core unpack code has always been like that though, but the other parts look good.
50b6dea to
7795e89
Compare
Yep the unpack code isn't trivial to follow or make changes to. When I am working on this patch my primary focus was keeping the existing logic without too much refactoring. |
7795e89 to
9f6792b
Compare
f1660de to
9da85bf
Compare
| errs = errors.Join(errs, err) | ||
| } | ||
| } | ||
| if errs != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this return errs and not err?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
plugins/snapshots/overlay/overlay.go
Outdated
| } | ||
|
|
||
| if info.Parent != "" && base.Parent != "" && base.Parent != info.Parent { | ||
| return fmt.Errorf("unabled to change parent of snapshot %q from %q to %q", key, info.Parent, base.Parent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo unable
core/snapshots/storage/bolt.go
Outdated
|
|
||
| // If the snapshot didn't have a parent when created, allow it | ||
| // to be rebased on a parent on commit. | ||
| if si.Parent == "" && si.Parent != base.Parent { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the logic would be better as first checking si.Parent != base.Parent. If si.Parent is empty, set it, otherwise, we should probably throw an invalid argument error.
| statusCh, err := topHalf(i, desc, layerSpan, unpackLayerStart) | ||
| if err != nil { | ||
| if parallel { | ||
| break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we close out the status channels here or will the context cancellation propagate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The context cancellation will propagate and cause all goroutines created by top halves to return. On return the defer func will close the status channels.
9da85bf to
f5fc44b
Compare
Signed-off-by: Henry Wang <henwang@amazon.com>
f5fc44b to
0198b87
Compare
| return err | ||
| } | ||
|
|
||
| if len(info.Parent) > 0 && len(base.Parent) > 0 && info.Parent != base.Parent { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need to make the change in this PR, but I think we could just remove this logic now and let the storage error handle this. This also means there is no other change needed in other snapshotters other than to set the capability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. I can change it in a follow-up PR.
Implement #8881 based on the discussions in the thread.
New config
Add
max_concurrent_unpacksconfig to transfer service. If this value is >1, parallel unpacking feature could be enabled if the snapshotter has "rebase" capability.New snapshotter capability
Added
rebasecapability to snapshotters. A snapshotter can declare this capability to allow parallel unpacking. The overlayfs snapshotter is updated in this PR to announce this capability.The "rebase" is performed in the
Commitsnapshotter API. The caller will pass in theWithParentsnapshot option. The snapshotter can rebase the current snapshot onto the parent during the commit operation.This rebase capability requires a update to the API protobuf to add a
parentfield into theCommitSnapshotRequestmessage.Updated unpacker logic
The existing
doUnpackFnis split to two halves.