singhpk234 commented on code in PR #5888:
URL: https://github.com/apache/iceberg/pull/5888#discussion_r983872476


##########
core/src/main/java/org/apache/iceberg/BaseTransaction.java:
##########
@@ -479,6 +480,52 @@ private void applyUpdates(TableOperations underlyingOps) {
           // Cannot pass even with retry due to conflicting metadata changes. 
So, break the
           // retry-loop.
           throw new PendingUpdateFailedException(e);
+
+        } catch (ValidationException e) {
+          if (PropertyUtil.propertyAsBoolean(
+              base.properties(),
+              TableProperties.ROLLBACK_COMPACTION_ON_CONFLICTS_ENABLED,
+              
TableProperties.ROLLBACK_COMPACTION_ON_CONFLICTS_ENABLED_DEFAULT)) {
+
+            // use refreshed metadata
+            this.base = underlyingOps.current();
+            this.current = underlyingOps.current();
+            Long rollbackToSnapshotId = current.currentSnapshot().parentId();
+            long currentSnapshotId = current.currentSnapshot().snapshotId();
+            boolean updatesAppliedSuccessfully = false;
+
+            while (rollbackToSnapshotId != null
+                && !updatesAppliedSuccessfully
+                && PropertyUtil.propertyAsBoolean(

Review Comment:
   >  I discussed with you a bit offline as well, I think instead of 
introducing a new property of is-compacted, it seems like we can rollback 
whenever we have conflict and 
current.snapshot(currentSnapshotId).equals(DataOperations.REPLACE)
   
   Apologies, I missed that. I think it makes sense to use snapshot#operation 
to identify if it's a compaction. Updated the PR & description.
   
   



-- 
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]

Reply via email to