Skip to content

fix(table): close writers on error for every exit path - #667

Merged
zeroshade merged 1 commit into
apache:mainfrom
ferhatelmas:fix-writers
Jan 8, 2026
Merged

zeroshade merged 1 commit into
apache:mainfrom
ferhatelmas:fix-writers

Conversation

@ferhatelmas

Copy link
Copy Markdown
Contributor

related to #644

if err != nil {
return nil, err
}
defer internal.CheckedClose(wr, &err)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this doesn't cause an error when we successfully call close at line 300?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

iceberg-go/manifest.go

Lines 1124 to 1126 in 9e4a5b7

if w.closed {
return nil
}

no because it's no-op, Close() sets closed field to true (first defer) and when it's true (second defer), it returns early

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sounds good then. Is there anything else needed before you shift this out of Draft?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I reviewed for the pattern if there were more and found a few more cases. Fixed and added a regression test, should be good to go now. Marking ready

@zeroshade zeroshade left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

just one nitpick question but otherwise looks good!

@ferhatelmas
ferhatelmas marked this pull request as ready for review January 8, 2026 00:50

@kevinjqliu kevinjqliu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! I double checked for all usage of NewManifestWriter and ManifestListWriter

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.

3 participants