pvary commented on code in PR #15389:
URL: https://github.com/apache/iceberg/pull/15389#discussion_r2840026221


##########
core/src/main/java/org/apache/iceberg/BaseTransaction.java:
##########
@@ -252,25 +259,20 @@ UpdateSnapshotReferencesOperation 
updateSnapshotReferencesOperation() {
 
   @Override
   public void commitTransaction() {
+    Preconditions.checkState(state == State.OPEN, "Cannot commit transaction 
in state: %s", state);
+
     Preconditions.checkState(
         hasLastOpCommitted, "Cannot commit transaction: last operation has not 
committed");
 
     switch (type) {
-      case CREATE_TABLE:
-        commitCreateTransaction();
-        break;
-
-      case REPLACE_TABLE:
-        commitReplaceTransaction(false);
-        break;
-
-      case CREATE_OR_REPLACE_TABLE:
-        commitReplaceTransaction(true);
-        break;
+      case CREATE_TABLE -> commitCreateTransaction();
+      case REPLACE_TABLE -> commitReplaceTransaction(false);
+      case CREATE_OR_REPLACE_TABLE -> commitReplaceTransaction(true);
+      case SIMPLE -> commitSimpleTransaction();
+    }
 
-      case SIMPLE:
-        commitSimpleTransaction();
-        break;
+    if (ops.commitMode() == CommitMode.AUTO) {
+      state = State.COMMITTED;

Review Comment:
   I'm not sure about this one. Could you please help me understand?
   
   Isn't it something the extended classes should handle?



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