flyrain commented on a change in pull request #2552:
URL: https://github.com/apache/iceberg/pull/2552#discussion_r625440611
##########
File path: core/src/main/java/org/apache/iceberg/MergingSnapshotProducer.java
##########
@@ -390,7 +394,16 @@ protected void validateDataFilesExist(TableMetadata base,
Long startingSnapshotI
@Override
public Object updateEvent() {
long snapshotId = snapshotId();
- long sequenceNumber = ops.refresh().snapshot(snapshotId).sequenceNumber();
+ Snapshot justSaved = ops.refresh().snapshot(snapshotId);
+ long sequenceNumber = 0;
+ if( justSaved == null) {
+ // The snapshot just saved may not be present if the latest metadata
couldn't be loaded due to eventual
+ // consistency problems in refresh.
+ LOG.warn("Failed to load committed snapshot, leave sequence number to
0");
+ } else {
+ sequenceNumber = justSaved.sequenceNumber();
Review comment:
Good catch. Make sense to set it to -1 since its initial value is 0 and
increase monotonically as this line shows
https://github.com/apache/iceberg/blob/9edb1fabc0a4ad4c3f10625c4a15918bf5790f8b/core/src/main/java/org/apache/iceberg/TableMetadata.java#L356
Posted a new commit to fix it.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]