ajantha-bhat commented on code in PR #7641:
URL: https://github.com/apache/iceberg/pull/7641#discussion_r1198550489
##########
nessie/src/test/java/org/apache/iceberg/nessie/TestNessieTable.java:
##########
@@ -579,6 +584,50 @@ public void testGCEnabled() {
"Cannot expire snapshots: GC is disabled (deleting files may
corrupt other tables)");
}
+ @Test
+ public void testTableMetadataFilesCleanupDisable() {
+ Table icebergTable = catalog.loadTable(TABLE_IDENTIFIER);
+
+ Assertions.assertThat(
+
icebergTable.properties().get(TableProperties.METADATA_DELETE_AFTER_COMMIT_ENABLED))
+ .isNotNull()
+ .isEqualTo("false");
+
+ // Forceful setting of property also should get override with false
+ icebergTable
+ .updateProperties()
+ .set(TableProperties.METADATA_DELETE_AFTER_COMMIT_ENABLED, "true")
+ .commit();
+ Assertions.assertThat(
+
icebergTable.properties().get(TableProperties.METADATA_DELETE_AFTER_COMMIT_ENABLED))
+ .isNotNull()
+ .isEqualTo("false");
+
+ icebergTable
+ .updateProperties()
+ .set(TableProperties.METADATA_PREVIOUS_VERSIONS_MAX, "1")
+ .commit();
+
+ String metadataFileLocation =
+ ((BaseTable)
icebergTable).operations().current().metadataFileLocation();
+ Path metadataFileLocationPath =
Paths.get(metadataFileLocation.replaceFirst("file:", ""));
+
+ Assertions.assertThat(metadataFileLocationPath).exists();
+
+ icebergTable.updateSchema().addColumn("x1", Types.LongType.get()).commit();
+ icebergTable.updateSchema().addColumn("x2", Types.LongType.get()).commit();
+
+ // old table metadata file should still exist after commits.
+ Assertions.assertThat(metadataFileLocationPath).exists();
Review Comment:
Nice suggestion. Added it.
--
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]