sshivampeta commented on code in PR #16289:
URL: https://github.com/apache/iceberg/pull/16289#discussion_r3278350256


##########
core/src/main/java/org/apache/iceberg/UpdateRequirements.java:
##########
@@ -41,7 +41,9 @@ public static List<UpdateRequirement> forReplaceTable(
       TableMetadata base, List<MetadataUpdate> metadataUpdates) {
     Preconditions.checkArgument(null != base, "Invalid table metadata: null");
     Preconditions.checkArgument(null != metadataUpdates, "Invalid metadata 
updates: null");
-    Builder builder = new Builder(base, true);
+    // use the same optimistic concurrency checks as ordinary commits; replace 
commits must not
+    // silently drop concurrent schema, partition spec, sort order, or ref 
changes.
+    Builder builder = new Builder(base, false);

Review Comment:
   ```
   Added 5 tests in TestUpdateRequirements:
   
   replaceTableAddSchemaProducesFieldIdRequirement — verifies forReplaceTable 
now emits AssertLastAssignedFieldId
   replaceTableAddSchemaFailsOnConcurrentFieldIdChange — verifies field-id 
conflict detection fails as expected
   replaceTableSetCurrentSchemaProducesSchemaIdRequirement — verifies 
AssertCurrentSchemaID is emitted
   replaceTableAddPartitionSpecProducesPartitionIdRequirement — verifies 
AssertLastAssignedPartitionId is emitted
   replaceTableAddSortOrderProducesDefaultSortOrderRequirement — verifies 
AssertDefaultSortOrderID is emitted
   These confirm that forReplaceTable with Builder(base, false) now produces 
the same OCC requirements as forUpdateTable, rather than skipping them as it 
did with Builder(base, true).
   ```



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