Skip to content

refactor(catalog/internal): Improve error handling in WriteTableMetadata and WriteMetadata functions - #541

Merged
zeroshade merged 2 commits into
apache:mainfrom
xixipi-lining:fix_utils
Aug 22, 2025
Merged

zeroshade merged 2 commits into
apache:mainfrom
xixipi-lining:fix_utils

Conversation

@xixipi-lining

Copy link
Copy Markdown
Contributor

Changes

  • Updated the WriteTableMetadata and WriteMetadata functions to use errors.Join for better error handling, ensuring that both JSON encoding errors and file close errors are properly captured and returned.
  • This fix is particularly important for S3 storage where the actual upload happens during Close(), and previous implementation would silently ignore S3 upload failures.

…ata and WriteMetadata functions

### Changes
- Updated the `WriteTableMetadata` and `WriteMetadata` functions to use `errors.Join` for better error handling, ensuring that both the encoding of metadata and the closing of the output stream are managed together.
### Changes
- Modified assertions in `TestGlueCreateTableRollbackOnInvalidMetadata` to ensure that the `CreateTable`, `DeleteTable`, and `GetTable` methods are not called when an error occurs due to invalid metadata. This aligns the test behavior with the expected outcomes of the Glue catalog operations.
@zeroshade
zeroshade merged commit b8dd3c7 into apache:main Aug 22, 2025
@xixipi-lining
xixipi-lining deleted the fix_utils branch August 25, 2025 03:10
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.

2 participants