hemanthboyina commented on code in PR #15148:
URL: https://github.com/apache/iceberg/pull/15148#discussion_r2734905778
##########
core/src/test/java/org/apache/iceberg/TestSetStatistics.java:
##########
@@ -106,4 +108,60 @@ public void testRemoveStatistics() {
assertThat(version()).isEqualTo(3);
assertThat(metadata.statisticsFiles()).isEmpty();
}
+
+ @TestTemplate
+ public void testSetStatisticsRetryWithConcurrentModification() {
+ table.newFastAppend().appendFile(FILE_A).commit();
+ TableMetadata base = readMetadata();
+ long snapshotId = base.currentSnapshot().snapshotId();
+
+ GenericStatisticsFile statisticsFile =
+ new GenericStatisticsFile(
+ snapshotId, "/some/statistics/file.puffin", 100, 42,
ImmutableList.of());
+
+ UpdateStatistics updateStats =
table.updateStatistics().setStatistics(statisticsFile);
+
+ table.newFastAppend().appendFile(FILE_B).commit();
+
+ updateStats.commit();
+
+
assertThat(readMetadata().statisticsFiles()).containsExactly(statisticsFile);
+ }
+
+ @TestTemplate
+ public void testSetStatisticsRetryExhaustion() {
+ table.updateProperties().set(TableProperties.COMMIT_NUM_RETRIES,
"2").commit();
+
+ table.newFastAppend().appendFile(FILE_A).commit();
+ long snapshotId = readMetadata().currentSnapshot().snapshotId();
+
+ GenericStatisticsFile statisticsFile =
+ new GenericStatisticsFile(
+ snapshotId, "/some/statistics/file.puffin", 100, 42,
ImmutableList.of());
+
+ TestTables.TestTableOperations ops = table.ops();
+ ops.failCommits(3);
Review Comment:
I think we should use
Integer.parseInt(
table.properties().getOrDefault(TableProperties.COMMIT_NUM_RETRIES, "4")
+ 1 ?
--
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]