nastra commented on code in PR #8147:
URL: https://github.com/apache/iceberg/pull/8147#discussion_r1274481805


##########
core/src/main/java/org/apache/iceberg/UpdateRequirement.java:
##########
@@ -199,4 +220,56 @@ public void validate(TableMetadata base) {
       }
     }
   }
+
+  class AssertLastAssignedViewVersionId implements UpdateRequirement {
+    private final int versionId;
+
+    public AssertLastAssignedViewVersionId(int versionId) {
+      this.versionId = versionId;
+    }
+
+    public int versionId() {
+      return versionId;
+    }
+
+    @Override
+    public void validate(TableMetadata base) {
+      // noop
+    }
+
+    @Override
+    public void validate(ViewMetadata base) {
+      if (versionId != base.currentVersionId()) {
+        throw new CommitFailedException(
+            "Requirement failed: last assigned view version id changed: 
expected id %s != %s",
+            versionId, base.currentVersionId());
+      }
+    }
+  }
+
+  class AssertCurrentViewVersionID implements UpdateRequirement {

Review Comment:
   > We could add this if we wanted to make it possible to perform either an 
idempotent replace OR fail.
   
   Yes that was exactly the goal here and the only reason we would need this. 
However, I can't find a strong argument that would justify having this now. 
   
   That being said, I think you're right and we can remove all requirements for 
Views for now.



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