aokolnychyi commented on code in PR #6015:
URL: https://github.com/apache/iceberg/pull/6015#discussion_r998903659
##########
core/src/test/java/org/apache/iceberg/util/TestSnapshotUtil.java:
##########
@@ -75,9 +75,9 @@ public void before() throws Exception {
this.table = TestTables.create(tableDir, "test", SCHEMA, SPEC, 2);
table.newFastAppend().appendFile(FILE_A).commit();
- this.snapshotAId = table.currentSnapshot().snapshotId();
-
- snapshotATimestamp = System.currentTimeMillis();
+ Snapshot snapshotA = table.currentSnapshot();
+ this.snapshotAId = snapshotA.snapshotId();
+ this.snapshotATimestamp = snapshotA.timestampMillis() + 1;
Review Comment:
I am afraid it does not guarantee the timestamp of snapshot B. Would it be
more reliable to use `waitUntilAfter`?
```
Snapshot snapshotA = table.currentSnapshot();
this.snapshotAId = snapshotA.snapshotId();
this.snapshotATimestamp = snapshotA.timestampMillis();
TestHelpers.waitUntilAfter(snapshotATimestamp);
...
```
Then we can adapt the test to call `SnapshotUtil.oldestAncestorAfter(table,
snapshotATimestamp + 1)`.
##########
core/src/test/java/org/apache/iceberg/util/TestSnapshotUtil.java:
##########
@@ -75,9 +75,9 @@ public void before() throws Exception {
this.table = TestTables.create(tableDir, "test", SCHEMA, SPEC, 2);
table.newFastAppend().appendFile(FILE_A).commit();
- this.snapshotAId = table.currentSnapshot().snapshotId();
-
- snapshotATimestamp = System.currentTimeMillis();
+ Snapshot snapshotA = table.currentSnapshot();
+ this.snapshotAId = snapshotA.snapshotId();
+ this.snapshotATimestamp = snapshotA.timestampMillis() + 1;
Review Comment:
I am afraid it does not guarantee the timestamp of snapshot B.
Would it be more reliable to use `waitUntilAfter`?
```
Snapshot snapshotA = table.currentSnapshot();
this.snapshotAId = snapshotA.snapshotId();
this.snapshotATimestamp = snapshotA.timestampMillis();
TestHelpers.waitUntilAfter(snapshotATimestamp);
...
```
Then we can adapt the test to call `SnapshotUtil.oldestAncestorAfter(table,
snapshotATimestamp + 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]