Skip to content
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

Revert diff/walking error change #5566

Merged
merged 1 commit into from Jun 6, 2021

Conversation

dmcgowan
Copy link
Member

@dmcgowan dmcgowan commented Jun 3, 2021

Clarify error scope and create variable for deferring cleanup

Reverts #5551

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jun 3, 2021

Build succeeded.

@Iceber
Copy link
Member

Iceber commented Jun 4, 2021

// Commit commits the blob (but no roll-back is guaranteed on an error).

Does it mean that we need to perform roll-back after a Commit failure?
eg.

if newReference {
        if abortErr := s.store.Abort(ctx, config.Reference); abortErr != nil {
                log.G(ctx).WithError(abortErr).WithField("ref", config.Reference).Warnf("failed to delete diff upload")
        }
}

// Writer handles the write of content into a content store
type Writer interface {
// Close closes the writer, if the writer has not been
// committed this allows resuming or aborting.
// Calling Close on a closed writer will not error.
io.WriteCloser

Since calling Close on a closed writer will not error, we can set the errOpen after a failed Commit.

if err := cw.Commit(ctx, 0, dgst, commitopts...); err != nil {
        if !errdefs.IsAlreadyExists(err) {
                errOpen = err
                return errors.Wrap(err, "failed to commit")
        }
}

Clarify error scope and create variable for deferring cleanup

Signed-off-by: Derek McGowan <derek@mcg.dev>
@dmcgowan
Copy link
Member Author

dmcgowan commented Jun 4, 2021

Does it mean that we need to perform roll-back after a Commit failure?

I think in this case calling Abort is the best thing to do. Not aborting on Commit failure allows the caller to try again, but that is not relevant here. I updated the code to just use errOpen on Commit

@theopenlab-ci
Copy link

theopenlab-ci bot commented Jun 4, 2021

Build succeeded.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

thanks for the additional comments

Copy link
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

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

LGTM

@fuweid fuweid merged commit f6061b4 into containerd:master Jun 6, 2021
@dmcgowan dmcgowan deleted the cleanup-diff-walking branch April 20, 2024 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants