Skip to content

Conversation

@iyear
Copy link
Contributor

@iyear iyear commented Oct 14, 2022

Signed-off-by: iyear [email protected]

For more information, please see: #7528

@k8s-ci-robot
Copy link

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@iyear iyear force-pushed the refactor-metastore-tx branch from a1cad91 to 0eef6aa Compare October 14, 2022 12:21
@k8s-ci-robot
Copy link

@iyear: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

/retest

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.

@samuelkarp
Copy link
Member

/ok-to-test

@samuelkarp
Copy link
Member

You may want to rebase on main; TestSandboxRemoveWithoutIPLeakage failed in a few of the CI runs and that should be less flaky now on main.

@iyear iyear force-pushed the refactor-metastore-tx branch 2 times, most recently from b4f96e3 to 3009337 Compare October 17, 2022 05:38
@iyear
Copy link
Contributor Author

iyear commented Oct 17, 2022

Yesterday's CI only Vagrant BOX:rockylinux/8 reports errors, but this one had four failures. I didn't change any code, just sync fork :(

@iyear iyear force-pushed the refactor-metastore-tx branch from 3009337 to 60330f1 Compare October 18, 2022 02:03
@dmcgowan dmcgowan self-assigned this Nov 30, 2022
@dcantah
Copy link
Member

dcantah commented Dec 24, 2022

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!

@iyear
Copy link
Contributor Author

iyear commented Dec 24, 2022

@dcantah It doesn't matter. Thanks!

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{}, ""
Copy link
Member

@dcantah dcantah Dec 24, 2022

Choose a reason for hiding this comment

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

Suggested change
id, info, parentID := "", snapshots.Info{}, ""
var (
id, parentID string
info snapshots.Info
)

}
}()
func (b *snapshotter) makeSnapshot(ctx context.Context, kind snapshots.Kind, key, parent string, opts []snapshots.Opt) (_ []mount.Mount, err error) {
target, s := "", storage.Snapshot{}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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 {
Copy link
Member

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 🤣

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤣

return nil
})

defer func() {
Copy link
Member

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

s, err := storage.GetSnapshot(ctx, key)
t.Rollback()
func (b *snapshotter) Mounts(ctx context.Context, key string) (_ []mount.Mount, err error) {
s := storage.Snapshot{}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
s := storage.Snapshot{}
var s storage.Snapshot

}
err = t.Commit()
t = nil
return btrfs.SubvolSnapshot(target, parentp, kind == snapshots.KindView)
Copy link
Member

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".

if rerr := t.Rollback(); rerr != nil {
log.G(ctx).WithError(rerr).Warn("failed to rollback transaction")
}
source, target := "", ""
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
source, target := "", ""
var source, target string

Copy link
Member

@dcantah dcantah left a 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?

@iyear
Copy link
Contributor Author

iyear commented Dec 24, 2022

@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

@iyear iyear force-pushed the refactor-metastore-tx branch from b342510 to 826f53a Compare December 24, 2022 08:47
@iyear
Copy link
Contributor Author

iyear commented Dec 24, 2022

What does the Project Check error mean? I just rebase and force push the code.

@dcantah
Copy link
Member

dcantah commented Dec 24, 2022

@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.

Copy link
Member

@dcantah dcantah left a comment

Choose a reason for hiding this comment

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

LGTM on green

@iyear iyear force-pushed the refactor-metastore-tx branch from 826f53a to 0978b07 Compare December 24, 2022 09:44
@fuweid
Copy link
Member

fuweid commented Dec 24, 2022

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.

@iyear iyear force-pushed the refactor-metastore-tx branch from 04fbed4 to ea8adf0 Compare December 26, 2022 08:15
Copy link
Member

@dmcgowan dmcgowan left a 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

@iyear iyear force-pushed the refactor-metastore-tx branch from ea8adf0 to ba5c88c Compare December 28, 2022 05:37
@iyear
Copy link
Contributor Author

iyear commented Dec 28, 2022

@dmcgowan done:)

@iyear iyear force-pushed the refactor-metastore-tx branch 2 times, most recently from ed51dcf to 6baa924 Compare December 28, 2022 09:36
@iyear iyear force-pushed the refactor-metastore-tx branch from 6baa924 to 1d0619b Compare December 28, 2022 10:37
Copy link
Member

@fuweid fuweid left a 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!

@dmcgowan dmcgowan merged commit cfe7ac9 into containerd:main Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants