Skip to content

Commit

Permalink
Throw TrinoException when Iceberg commit fails
Browse files Browse the repository at this point in the history
  • Loading branch information
pajaks committed Sep 6, 2024
1 parent 21198fa commit b4c7f28
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1624,7 +1624,7 @@ private static void commitUpdateAndTransaction(SnapshotUpdate<?> update, Connect
commit(update, session);
commitTransaction(transaction, operation);
}
catch (UncheckedIOException e) {
catch (UncheckedIOException | ValidationException e) {
throw new TrinoException(ICEBERG_COMMIT_ERROR, format("Failed to commit during %s: %s", operation, firstNonNull(e.getMessage(), e)), e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ public void testDeleteRowsConcurrently()
ExecutorService executor = newFixedThreadPool(threads);
List<String> rows = ImmutableList.of("(1, 0, 0, 0)", "(0, 1, 0, 0)", "(0, 0, 1, 0)", "(0, 0, 0, 1)");

String[] expectedErrors = new String[] {"Failed to commit the transaction during write:", "Failed to replace table due to concurrent updates:"};
String[] expectedErrors = new String[] {"Failed to commit the transaction during write:",
"Failed to replace table due to concurrent updates:",
"Failed to commit during write:"};
try (TestTable table = new TestTable(
getQueryRunner()::execute,
"test_concurrent_delete",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ protected void verifyVersionedQueryFailurePermissible(Exception e)
@Override
protected void verifyConcurrentUpdateFailurePermissible(Exception e)
{
assertThat(e).hasMessageContaining("Failed to commit the transaction during write");
assertThat(e).hasMessageMatching("Failed to commit the transaction during write.*|" +
"Failed to commit during write.*");
}

@Override
Expand Down

0 comments on commit b4c7f28

Please sign in to comment.