Copilot commented on code in PR #2881:
URL: https://github.com/apache/fluss/pull/2881#discussion_r2939861902
##########
fluss-lake/fluss-lake-iceberg/src/test/java/org/apache/fluss/lake/iceberg/tiering/IcebergTieringTest.java:
##########
@@ -274,6 +285,108 @@ public Configuration flussClientConfig() {
});
}
+ @ParameterizedTest
+ @MethodSource("snapshotExpireArgs")
+ void testSnapshotExpiration(
+ boolean isTableAutoExpireSnapshot, boolean
isLakeTieringExpireSnapshot)
+ throws Exception {
+ int bucketNum = 3;
+ TablePath tablePath =
+ TablePath.of(
+ "iceberg",
+ String.format(
+ "test_snapshot_expire_%s_%s",
+ isTableAutoExpireSnapshot,
isLakeTieringExpireSnapshot));
+
+ // Create Iceberg table with snapshot retention properties
+ Map<String, String> tableProperties = new HashMap<>();
+ tableProperties.put(TableProperties.MIN_SNAPSHOTS_TO_KEEP, "1");
+ tableProperties.put(TableProperties.MAX_SNAPSHOT_AGE_MS, "1");
+ createTable(tablePath, false, false, tableProperties);
+
+ TableDescriptor descriptor =
+ TableDescriptor.builder()
+ .schema(
+ org.apache.fluss.metadata.Schema.newBuilder()
+ .column("c1", DataTypes.INT())
+ .column("c2", DataTypes.STRING())
+ .column("c3", DataTypes.STRING())
+ .build())
+ .distributedBy(bucketNum)
+ .property(ConfigOptions.TABLE_DATALAKE_ENABLED, true)
+ .property(
+
ConfigOptions.TABLE_DATALAKE_AUTO_EXPIRE_SNAPSHOT,
+ isTableAutoExpireSnapshot)
+ .build();
+ TableInfo tableInfo = TableInfo.of(tablePath, 0, 1, descriptor, 1L,
1L);
+
+ Configuration lakeTieringConfig = new Configuration();
+ lakeTieringConfig.set(
+ ConfigOptions.LAKE_TIERING_AUTO_EXPIRE_SNAPSHOT,
isLakeTieringExpireSnapshot);
+
+ // Write data multiple times to generate snapshots
+ for (int round = 0; round < 5; round++) {
+ writeData(tablePath, tableInfo, lakeTieringConfig, bucketNum);
+ // Small delay to ensure snapshots are older than
MAX_SNAPSHOT_AGE_MS=1ms
+ Thread.sleep(10);
+ }
Review Comment:
This test relies on `Thread.sleep` + a 1ms snapshot age to make snapshots
eligible for expiration, which can be timing-sensitive and may cause flakes on
slow/loaded CI environments. Consider making the expiration condition
deterministic (e.g., use a larger max age with a clear margin, or drive
expiration based on snapshot timestamps rather than wall-clock sleeps) to avoid
time-based dependencies in the test.
--
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]