Lakehouse writers create files privately and then optimistically commit metadata. A writer using an old snapshot may still commit when intervening writes touched different partitions.
Design a LakehouseCommitCoordinator class:
boolean commit(int baseVersion, int[] partitions) attempts a write.int currentVersion() returns the latest successful version, starting at 0.
Reject a commit when any successful version after baseVersion touched one of the requested partitions. Otherwise create the next version and record the distinct partition set. Failed attempts do not create versions. Inputs always use 0 <= baseVersion <= currentVersion().
Example 1:
Example 2:
Constraints
1 <= partitions.length <= 1000 <= partitions[i] <= 10^9- At most
500 successful commits and 1000 total calls occur per object. 0 <= baseVersion <= currentVersion().