Skip to content

fix(catalog): ensure we close metadata writers - #666

Merged
zeroshade merged 2 commits into
apache:mainfrom
zeroshade:close-metadata
Jan 8, 2026
Merged

zeroshade merged 2 commits into
apache:mainfrom
zeroshade:close-metadata

Conversation

@zeroshade

Copy link
Copy Markdown
Member

While looking into #644 I found exactly one location which seems that we could end up failing to close a writer. So this fixes that spot and properly uses our CheckedClose utility to ensure we close the file writer.

In theory this should fix #644 but I haven't yet been able to write a good test for this.

@zeroshade

Copy link
Copy Markdown
Member Author

@tlarsendataguy could you take a look and see if you can confirm this fixes the issue you saw?

Comment thread catalog/internal/utils.go Outdated
Comment on lines 58 to 59
default:
return fmt.Errorf("unsupported write metadata compression codec: %s", compression)

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.

Change seems correct functionally.

If it's fine to refactor a bit, I would move validation to the top so that if wrong input codec is given, it can skip creating a writer and closing it completely, instead return early

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

is the new version pretty much what you were thinking?

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.

yes, looks good to me

@ferhatelmas

Copy link
Copy Markdown
Contributor

I think it's not the right fix because failure happens only on wrong input which is deterministic but #644 sounds like it's operational (i.e. network error). Regardless, this is a solid fix but a different one.

@ferhatelmas

Copy link
Copy Markdown
Contributor

I believe #667 is the real fix for #644. Let me know if it makes sense then we should review the pattern for other existences.

@tlarsendataguy

Copy link
Copy Markdown

@zeroshade, @ferhatelmas I'll see what I can do to test this and #667. I don't have a good test, either. I only got my failure after 2-3 days of running my pipeline at full capacity.

@zeroshade
zeroshade requested review from Fokko and kevinjqliu January 6, 2026 22:25

@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! Thanks

@zeroshade
zeroshade merged commit b81fbd8 into apache:main Jan 8, 2026
11 of 12 checks passed
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.

A blob.Writer was never closed (table corrupted)

4 participants