ryanworl opened a new pull request, #1891:
URL: https://github.com/apache/iceberg-go/pull/1891

   ## What
   
   Adds `Transaction.AssertDefaultShape`: an explicit fence pinning the table's 
default partition spec id and default sort order id at their base values — the 
layout analogue of `Transaction.AssertRefSnapshotID` (#1786), which pins a ref. 
It applies the existing `AssertDefaultSpecID` + `AssertDefaultSortOrderID` 
requirements from the base table metadata, and deduplicates against the 
producer-built assertions `UpdateSpec` and `ReplaceSortOrder` already register 
(same JSON, same pinned ids).
   
   ## Why
   
   Java's 
[`UpdateRequirements.forUpdateTable`](https://github.com/apache/iceberg/blob/master/core/src/main/java/org/apache/iceberg/UpdateRequirements.java)
 registers `AssertDefaultSpecID` / `AssertDefaultSortOrderID` when a commit 
*changes* those defaults, but a commit that stages no spec or sort-order change 
of its own (e.g. properties-only) carries no shape assertion, so two racers 
evolving a table's declaration can interleave. Java has no user-callable 
equivalent; this is an explicit API for a fence Java only applies implicitly.
   
   Register the fence before staging spec or sort-order changes: requirements 
are validated against staged metadata at registration time. The fence is never 
rewritten by refresh-and-replay. A transaction with no updates never contacts 
the catalog, so the fence alone does not force a commit.
   
   Naming: "shape" is not spec terminology — happy to rename (e.g. 
`AssertDefaultSpecAndSortOrder`) if preferred.
   
   ## Tests
   
   - Properties-only commit succeeds when the shape is unmoved; fails with 
`ErrCommitFailed` (properties not applied) when the default spec or default 
sort order moved in between.
   - Double-register plus `ReplaceSortOrder` collapses to one spec assertion 
and one sort-order assertion.
   - `go test ./table/...` and `golangci-lint run` are clean.
   
   Made with [Cursor](https://cursor.com)
   


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