Skip to content

implement POST /v1/transactions/commit endpoint #785

@laskoviymishka

Description

@laskoviymishka

Feature Request / Improvement

Implement CommitTransaction() on the REST catalog, satisfying the TransactionalCatalog interface.

Wire Format

POST /v1/{prefix}/transactions/commit
Content-Type: application/json

{
  "table-changes": [
    {
      "identifier": { "namespace": ["db"], "name": "t1" },
      "requirements": [
        { "type": "assert-table-uuid", "uuid": "..." },
        { "type": "assert-ref-snapshot-id", "ref": "main", "snapshot-id": 123 }
      ],
      "updates": [
        { "action": "add-snapshot", ... },
        { "action": "set-snapshot-ref", ... }
      ]
    },
    {
      "identifier": { "namespace": ["db"], "name": "t2" },
      "requirements": [ ... ],
      "updates": [ ... ]
    }
  ]
}

Response: 204 No Content

Error Handling

Status Error Meaning
404 ErrNoSuchTable A referenced table doesn't exist
409 ErrCommitFailed One or more requirements failed — entire transaction rejected
500, 502, 504 ErrCommitStateUnknown Server error — commit may or may not have been applied
503 ErrCommitStateUnknown Service unavailable

On 409, no tables are modified — all-or-nothing semantics.

Implementation Notes

  • Reuse existing doPostAllowNoContent helper with allowNoContent=true (expects 204)
  • Same error mapping pattern as CommitTable (rest.go:828-835)
  • JSON field name on the wire is "table-changes" (kebab-case, matching Java's CommitTransactionRequestParser)
  • Each entry in table-changes reuses the existing identifier, requirements, and updates serialization
  • No response body to parse
  • No retry logic built in (matches Java behavior — retries are the caller's responsibility)

Validation

  • commits list must not be empty
  • Every commit must have a non-nil Identifier (unlike single-table commit where the identifier is in the URL path)

References

Depends On

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions