nastra commented on code in PR #15148:
URL: https://github.com/apache/iceberg/pull/15148#discussion_r2767194461
##########
core/src/test/java/org/apache/iceberg/TestSetStatistics.java:
##########
@@ -106,4 +106,55 @@ public void testRemoveStatistics() {
assertThat(version()).isEqualTo(3);
assertThat(metadata.statisticsFiles()).isEmpty();
}
+
+ @TestTemplate
+ public void testSetStatisticsRetryWithConcurrentModification() {
+ 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.TestTable currentTable = table;
+
+ // Create a TableOperations that simulates concurrent modification
+ // On the first commit attempt, another writer modifies the table
+ TestTables.TestTableOperations concurrentOps =
+ new TestTables.TestTableOperations("test", tableDir, table.ops().io())
{
+ private int commitCount = 0;
+
+ @Override
+ public void commit(TableMetadata base, TableMetadata metadata) {
+ commitCount++;
+ if (commitCount == 1) {
+ currentTable.newFastAppend().appendFile(FILE_B).commit();
+ }
+ super.commit(base, metadata);
+ }
+ };
+
+ SetStatistics setStats = new SetStatistics(concurrentOps);
+ setStats.setStatistics(statisticsFile);
+ setStats.commit();
+
+
assertThat(readMetadata().statisticsFiles()).containsExactly(statisticsFile);
+ }
+
+ @TestTemplate
+ public void testSetStatisticsRetrySuccess() {
Review Comment:
```suggestion
public void setStatisticsRetrySuccess() {
```
--
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]