-
Notifications
You must be signed in to change notification settings - Fork 18
Fix Iceberg REST catalog commit safety under post-commit network failure #1982
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
base: antalya-26.3
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -545,11 +545,21 @@ static bool writeMetadataFiles( | |
| { | ||
| auto catalog_filename = path_resolver.resolveForCatalog(metadata_info.path); | ||
| const auto & [namespace_name, table_name] = DataLake::parseTableName(table_id.getTableName()); | ||
| if (!catalog->updateMetadata(namespace_name, table_name, catalog_filename, new_snapshot)) | ||
| const auto outcome = catalog->updateMetadata(namespace_name, table_name, catalog_filename, new_snapshot); | ||
| if (outcome == DataLake::CommitOutcome::RejectedCleanly) | ||
| { | ||
| cleanup(); | ||
| return false; | ||
| } | ||
| if (outcome == DataLake::CommitOutcome::Unknown) | ||
| { | ||
| LOG_ERROR( | ||
| getLogger("IcebergMutations"), | ||
| "Iceberg mutation commit for {}.{} is of unknown status after a lost response; " | ||
| "preserving written files to avoid corrupting a possibly-committed snapshot.", | ||
| namespace_name, table_name); | ||
| return false; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For Useful? React with 👍 / 👎. |
||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -1417,7 +1427,8 @@ ExpireSnapshotsResult expireSnapshots( | |
| { | ||
| auto catalog_filename = persistent_table_components.path_resolver.resolveForCatalog(metadata_info.path); | ||
| const auto & [namespace_name, parsed_table_name] = DataLake::parseTableName(table_name); | ||
| if (!catalog->updateMetadata(namespace_name, parsed_table_name, catalog_filename, nullptr)) | ||
| const auto outcome = catalog->updateMetadata(namespace_name, parsed_table_name, catalog_filename, nullptr); | ||
| if (outcome != DataLake::CommitOutcome::Committed) | ||
| { | ||
| throw Exception( | ||
| ErrorCodes::LOGICAL_ERROR, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
CommitOutcome::Unknownmeans the first catalog POST may already have landed but the verification read failed, returningfalsesends control back toIcebergStorageSink::finalizeBuffers' retry loop. At this pointgenerateNextMetadatahas already mutatedmetadataand the writers still hold the same data files, so the nextinitializeMetadataattempt can append those same files again on top of the possibly-committed snapshot instead of surfacing the ambiguous result to the user.Useful? React with 👍 / 👎.