-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Refactor metastore transaction #7529
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
Conversation
|
Hi @iyear. Thanks for your PR. I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
a1cad91 to
0eef6aa
Compare
|
@iyear: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/ok-to-test |
|
You may want to rebase on |
b4f96e3 to
3009337
Compare
|
Yesterday's CI only |
3009337 to
60330f1
Compare
|
As @kzys said on the issue, I did the same in #7781 🙃. I missed the issue and this PR so my apologies there. I think this is a much better model so it's a +1 from me at least for moving over the rest of the snapshotters. Luckily we chose the same API for how to expose this also with the exception of the callback being its own type, so a rebase should be super simple. I'll try and review this in the coming week! |
|
@dcantah It doesn't matter. Thanks! |
snapshots/btrfs/btrfs.go
Outdated
| if err == nil && info.Kind == snapshots.KindActive && info.Parent != "" { | ||
| parentID, _, _, err = storage.GetInfo(ctx, info.Parent) | ||
| func (b *snapshotter) usage(ctx context.Context, key string) (usage snapshots.Usage, err error) { | ||
| id, info, parentID := "", snapshots.Info{}, "" |
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.
| id, info, parentID := "", snapshots.Info{}, "" | |
| var ( | |
| id, parentID string | |
| info snapshots.Info | |
| ) |
snapshots/btrfs/btrfs.go
Outdated
| } | ||
| }() | ||
| func (b *snapshotter) makeSnapshot(ctx context.Context, kind snapshots.Kind, key, parent string, opts []snapshots.Opt) (_ []mount.Mount, err error) { | ||
| target, s := "", storage.Snapshot{} |
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.
| target, s := "", storage.Snapshot{} | |
| var ( | |
| target string | |
| s storage.Snapshot | |
| ) |
| ) | ||
|
|
||
| err = s.withTransaction(ctx, false, func(ctx context.Context) error { | ||
| err = s.store.WithTransaction(ctx, false, func(ctx context.Context) error { |
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.
Luckily this file shouldn't need to change at all 🤣
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.
🤣
snapshots/btrfs/btrfs.go
Outdated
| return nil | ||
| }) | ||
|
|
||
| defer func() { |
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.
I'd probably move this above the WithTransaction (and below the variable declarations) so you can see the cleanup case at the top of the method. Mostly a nit though
snapshots/btrfs/btrfs.go
Outdated
| s, err := storage.GetSnapshot(ctx, key) | ||
| t.Rollback() | ||
| func (b *snapshotter) Mounts(ctx context.Context, key string) (_ []mount.Mount, err error) { | ||
| s := storage.Snapshot{} |
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.
| s := storage.Snapshot{} | |
| var s storage.Snapshot |
snapshots/btrfs/btrfs.go
Outdated
| } | ||
| err = t.Commit() | ||
| t = nil | ||
| return btrfs.SubvolSnapshot(target, parentp, kind == snapshots.KindView) |
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.
Kind of a nit, but the explicit readOnly assignment made this slightly more readable. I'd have to go look at SubVolSnapshot's declaration to see what's the significance of either true or false (or be versed in what KindView signifies in containerd parlance), but before I can take a quick glance and go "oh, it's likely for a read only snapshot".
snapshots/btrfs/btrfs.go
Outdated
| if rerr := t.Rollback(); rerr != nil { | ||
| log.G(ctx).WithError(rerr).Warn("failed to rollback transaction") | ||
| } | ||
| source, target := "", "" |
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.
| source, target := "", "" | |
| var source, target string |
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.
Some Go nits and small refactorings, but change LGTM after! @iyear if we get this in, and others also like this model, do you want to do the honors for the remaining snapshotters?
|
@dcantah Thanks for review! The new commit has been pushed. I am glad to finish the remaining work, it's my pleasure. I will solve the conflict later |
b342510 to
826f53a
Compare
|
What does the |
|
@iyear Not sure if we figured this out, but our guess was a rate limit. I don't think there's anything wrong with your change 🫠. Don't have permissions to re-kick off the CI so I'd wait a little and re-push possibly to get a fresh run. |
dcantah
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.
LGTM on green
826f53a to
0978b07
Compare
|
I wonder that we can introduce ebpf or interface wrapper to inject the failpoint to test the snapshot, because the eyeball is hard mode. It can be followup. |
04fbed4 to
ea8adf0
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.
Changes look good, can you please squash the commits before merging
ea8adf0 to
ba5c88c
Compare
|
@dmcgowan done:) |
ed51dcf to
6baa924
Compare
Signed-off-by: Junyu Liu <[email protected]>
6baa924 to
1d0619b
Compare
fuweid
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.
LGTM on green
Thanks!
Signed-off-by: iyear [email protected]
For more information, please see: #7528