amogh-jahagirdar commented on code in PR #5234:
URL: https://github.com/apache/iceberg/pull/5234#discussion_r952246303
##########
core/src/main/java/org/apache/iceberg/SnapshotProducer.java:
##########
@@ -349,30 +354,34 @@ public void commit() {
base.propertyAsInt(COMMIT_TOTAL_RETRY_TIME_MS,
COMMIT_TOTAL_RETRY_TIME_MS_DEFAULT),
2.0 /* exponential */)
.onlyRetryOn(CommitFailedException.class)
- .run(taskOps -> {
- Snapshot newSnapshot = apply();
- newSnapshotId.set(newSnapshot.snapshotId());
- TableMetadata.Builder update = TableMetadata.buildFrom(base);
- if (base.snapshot(newSnapshot.snapshotId()) != null) {
- // this is a rollback operation
- update.setBranchSnapshot(newSnapshot.snapshotId(), targetBranch);
- } else if (stageOnly) {
- update.addSnapshot(newSnapshot);
- } else {
- update.setBranchSnapshot(newSnapshot, targetBranch);
- }
-
- TableMetadata updated = update.build();
- if (updated.changes().isEmpty()) {
- // do not commit if the metadata has not changed. for example,
this may happen when setting the current
- // snapshot to an ID that is already current. note that this
check uses identity.
- return;
- }
-
- // if the table UUID is missing, add it here. the UUID will be
re-created each time this operation retries
- // to ensure that if a concurrent operation assigns the UUID, this
operation will not fail.
- taskOps.commit(base, updated.withUUID());
- });
+ .run(
+ taskOps -> {
+ Snapshot newSnapshot = apply();
+ newSnapshotId.set(newSnapshot.snapshotId());
+ TableMetadata.Builder update = TableMetadata.buildFrom(base);
+ if (base.snapshot(newSnapshot.snapshotId()) != null) {
+ // this is a rollback operation
+ update.setBranchSnapshot(newSnapshot.snapshotId(),
targetBranch);
+ } else if (stageOnly) {
+ update.addSnapshot(newSnapshot);
+ } else {
+ update.setBranchSnapshot(newSnapshot, targetBranch);
+ }
+
+ TableMetadata updated = update.build();
+ if (updated.changes().isEmpty()) {
+ // do not commit if the metadata has not changed. for
example, this may happen
+ // when setting the current
+ // snapshot to an ID that is already current. note that this
check uses identity.
+ return;
+ }
+
+ // if the table UUID is missing, add it here. the UUID will be
re-created each time
+ // this operation retries
+ // to ensure that if a concurrent operation assigns the UUID,
this operation will
+ // not fail.
+ taskOps.commit(base, updated.withUUID());
+ });
Review Comment:
I think we can undo this.
--
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]