MehulBatra commented on code in PR #1584:
URL: https://github.com/apache/fluss/pull/1584#discussion_r2298024444
##########
fluss-lake/fluss-lake-iceberg/src/main/java/com/alibaba/fluss/lake/iceberg/tiering/IcebergLakeCommitter.java:
##########
@@ -173,9 +175,13 @@ public CommittedLakeSnapshot
getMissingLakeSnapshot(@Nullable Long latestLakeSna
}
// Check if there's a gap between Fluss and Iceberg snapshots
- if (latestLakeSnapshotIdOfFluss != null
- && latestLakeSnapshot.snapshotId() <=
latestLakeSnapshotIdOfFluss) {
- return null;
+ if (latestLakeSnapshotIdOfFluss != null) {
+ // note: we need to use sequence number to compare,
+ // we can't use snapshot id as the snapshot id is not ordered
+ Snapshot latestLakeSnapshotOfFluss =
icebergTable.snapshot(latestLakeSnapshotIdOfFluss);
+ if (latestLakeSnapshot.sequenceNumber() <=
latestLakeSnapshotOfFluss.sequenceNumber()) {
Review Comment:
We can add to handle a case where Fluss references a snapshot that no longer
exists in Iceberg
```
if (latestLakeSnapshotOfFluss == null) {
throw new IllegalStateException(
"Referenced Fluss snapshot " + latestLakeSnapshotIdOfFluss +
" not found in Iceberg table");
}
```
--
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]