RussellSpitzer commented on a change in pull request #3733:
URL: https://github.com/apache/iceberg/pull/3733#discussion_r768307041
##########
File path: core/src/test/java/org/apache/iceberg/TestTransaction.java
##########
@@ -699,4 +701,38 @@ public void
testTransactionRewriteManifestsAppendedDirectly() throws IOException
Assert.assertFalse("Append manifest should be deleted on expiry", new
File(newManifest.path()).exists());
}
+
+ @Test
+ public void testTransactionNotDeletingMetadataOnUnknownSate() throws
IOException {
+ String errorMsg = "datacenter on fire";
+
+ // Create a table ops such that: the commit actually succeeds but it
throws CommitStateUnknownException at the end
+ BiFunction<File, String, TestTables.TestTableOperations> opsSupplier =
(file, name) ->
+ new TestTables.TestTableOperations(name, file) {
+ @Override
+ public void commit(TableMetadata base, TableMetadata
updatedMetadata) {
+ super.commit(base, updatedMetadata);
+ throw new CommitStateUnknownException(new
RuntimeException(errorMsg));
+ }
+ };
+ Table table = TestTables.load(tableDir, "test", opsSupplier);
+
+ Transaction txn = table.newTransaction();
+ txn.newAppend()
+ .appendFile(FILE_A)
+ .commit();
+ try {
+ txn.commitTransaction();
Review comment:
Usually we use Assert Helpers for this sort of thing, makes it a bit
cleaner and you don't need to have an Assert.fail.
See
https://github.com/apache/iceberg/blob/9b84b00a1e5268458cdb03a3c8fb3e3603178dd3/hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCommits.java#L212-L214
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]