Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ protected void doCommit(TableMetadata base, TableMetadata metadata) {
String newMetadataLocation = writeNewMetadata(metadata, currentVersion() + 1);

boolean threw = true;
boolean delete = false;
try {
IcebergTable newTable = ImmutableIcebergTable.builder().metadataLocation(newMetadataLocation).build();
client.getContentsApi().setContents(key,
Expand All @@ -98,12 +99,14 @@ protected void doCommit(TableMetadata base, TableMetadata metadata) {
newTable);
threw = false;
} catch (NessieConflictException ex) {
delete = true;
throw new CommitFailedException(ex, "Commit failed: Reference hash is out of date. " +
"Update the reference %s and try again", reference.getName());
} catch (NessieNotFoundException ex) {
delete = true;
throw new RuntimeException(String.format("Commit failed: Reference %s no longer exist", reference.getName()), ex);
} finally {
if (threw) {
if (threw && delete) {
io().deleteFile(newMetadataLocation);
}
}
Expand Down