Refactor metastore transaction#7529
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.
| 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.
| 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.
Luckily this file shouldn't need to change at all 🤣
snapshots/btrfs/btrfs.go
Outdated
| return nil | ||
| }) | ||
|
|
||
| defer func() { |
There was a problem hiding this comment.
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.
| 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.
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.
| source, target := "", "" | |
| var source, target string |
|
@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. |
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.
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
Signed-off-by: iyear [email protected]
For more information, please see: #7528