Skip to content

Revert diff/walking error change#5566

Merged
fuweid merged 1 commit intocontainerd:masterfrom
dmcgowan:cleanup-diff-walking
Jun 6, 2021
Merged

Revert diff/walking error change#5566
fuweid merged 1 commit intocontainerd:masterfrom
dmcgowan:cleanup-diff-walking

Conversation

@dmcgowan
Copy link
Copy Markdown
Member

@dmcgowan dmcgowan commented Jun 3, 2021

Clarify error scope and create variable for deferring cleanup

Reverts #5551

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Jun 3, 2021

Build succeeded.

@Iceber
Copy link
Copy Markdown
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 <[email protected]>
@dmcgowan dmcgowan force-pushed the cleanup-diff-walking branch from ed56170 to 69f43d4 Compare June 4, 2021 15:44
@dmcgowan
Copy link
Copy Markdown
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
Copy Markdown

theopenlab-ci Bot commented Jun 4, 2021

Build succeeded.

Copy link
Copy Markdown
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
Copy Markdown
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.

5 participants