jackye1995 commented on code in PR #5888:
URL: https://github.com/apache/iceberg/pull/5888#discussion_r1120532647
##########
core/src/main/java/org/apache/iceberg/SnapshotProducer.java:
##########
@@ -215,7 +219,18 @@ public Snapshot apply() {
long sequenceNumber = base.nextSequenceNumber();
Long parentSnapshotId = parentSnapshot == null ? null :
parentSnapshot.snapshotId();
- validate(base, parentSnapshot);
+ try {
+ validate(base, parentSnapshot);
+ } catch (ValidationException ve) {
+ parentSnapshotId = snapshotIdToRollbackToOnConflict(parentSnapshotId);
Review Comment:
I think the logic that makes more sense in my mind is:
```
try {
validate(base, parentSnapshot);
} catch (ValidationException ve) {
if (shouldRollbackReplaceOnConflict()) {
// do rollback logic
} else {
// rethrow exception
}
}
```
instead of having the logic to determine the flag as a part of
`snapshotIdToRollbackToOnConflict` which is already determining the new parent
snapshot.
What do you think?
--
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]