Hi Iceberg community,

  I'd like to propose adding a new update requirement to the Iceberg REST
API spec: assert-last-sequence-number.


  *Problem*


  When multiple clients commit to the same table concurrently through the
REST catalog, sequence number conflicts can cause ValidationException
(non-retryable) instead of CommitFailedException (retryable). This prevents
automatic retry and leads to failed writes in concurrent scenarios. Details
in issue <https://github.com/apache/iceberg/issues/15001>. Repro in unit
tests
<https://github.com/apache/iceberg/pull/15002/files#diff-109d748c5f0501bcd65a94e6fd49596ec6da3ba069f0bb4eae1a054f34681e28>
.


  *Proposed Solution*


  Add a new requirement assert-last-sequence-number for addSnapshot that
validates the table's sequence number hasn't advanced past the snapshot
being committed:


  AssertLastSequenceNumber:

    type: object

    required:

      - type

      - last-sequence-number

    properties:

      type:

        type: string

        enum: ["assert-last-sequence-number"]

      last-sequence-number:

        type: integer

        format: int64


  This requirement would be automatically added when committing new
snapshots, turning concurrent conflicts into retryable CommitFailedException
.


  Solution PR as an example: https://github.com/apache/iceberg/pull/15002


  Would love to hear any suggestions or if there are other options you'd
prefer!


  Thanks,

  Xinyi

Reply via email to