Skip to content

[#10674] docs(iceberg): Add design doc for multi-table atomic commit in Iceberg REST catalog - #12195

Open
laserninja wants to merge 1 commit into
apache:mainfrom
laserninja:docs/10674-multi-table-atomic-commit-design
Open

[#10674] docs(iceberg): Add design doc for multi-table atomic commit in Iceberg REST catalog#12195
laserninja wants to merge 1 commit into
apache:mainfrom
laserninja:docs/10674-multi-table-atomic-commit-design

Conversation

@laserninja

Copy link
Copy Markdown
Collaborator

What changes were proposed in this pull request?

Adds a design document for the Iceberg REST catalog commitTransaction endpoint
(POST /v1/{prefix}/transactions/commit): design-docs/iceberg-multi-table-atomic-commit-design.md.

No production code changes.

The document proposes backend-capability dispatch rather than one uniform best-effort
implementation:

Backend Strategy
JDBC Batched CAS on a single Connection in one DB transaction
REST Forward the client's request body unmodified to the upstream catalog
MEMORY Single lock over the backing map
HIVE Not supported, returns 501; HMS Thrift has no multi-table transactional alter
CUSTOM Not supported unless the user's Catalog opts in

Endpoint.V1_COMMIT_TRANSACTION is advertised in /v1/config if and only if the resolved backend
can commit atomically, following the existing precedent where getEndpoints(supportsViewOperations)
already varies the advertised set by catalog capability. This means a client never sees the endpoint
advertised unless the guarantee behind it is real.

The document also covers:

  • Per-table authorization, closing the privilege-escalation gap raised in review. The
    @AuthorizationExpression interceptor resolves entities from path parameters, but this endpoint
    carries its tables in the request body, so authorization is done programmatically via
    MetadataAuthzHelper.checkAccess against the same expression updateTable uses. The expression is
    extracted into a shared constant so the two paths cannot drift.
  • Rejected alternatives, including the two-phase validate-then-commit approach from [#10674] feat(iceberg): implement commitTransaction REST endpoint for Iceberg REST catalog #10675 and a
    Polaris-style Gravitino-owned pointer store, with concrete reasons.
  • Orphaned-metadata semantics on rollback, and the lost-response case a client cannot detect.
  • A task breakdown across five phases, one task per follow-up issue/PR.

Why are the changes needed?

POST /v1/{prefix}/transactions/commit is part of the Iceberg REST Catalog spec and Gravitino does
not implement it, so engines cannot perform cross-table atomic operations against Gravitino.

The first implementation attempt (#10675) was found not to deliver atomic semantics: the commit phase
remained N independent compare-and-swap operations, so a failure partway through left a partial state.
Reviewers concluded that multi-table atomicity needs a design document before implementation, and
asked for one:

The design work also answers the question raised in
#10675 (comment) about which backends can
achieve true CAS: the capability differs per backend, and that asymmetry is what drives the proposed
design.

Fix: #10674

Does this PR introduce any user-facing change?

No. Documentation only.

The design it describes would introduce a new REST endpoint and a new entry in the /v1/config
endpoints list, but no code is changed in this PR.

How was this patch tested?

N/A, documentation only.

Claims about backend behaviour in the document were verified against the Iceberg 1.11.0 artifacts
this repo depends on rather than from memory, including JdbcUtil's commit SQL and discriminator
column, HiveTableOperations.doCommit's per-table alter_table path, TableCommit.create's
requirement derivation, and the visibility of ResourcePaths.commitTransaction() and
RESTClient.post.

…ommit

Adds a design document for the Iceberg REST catalog commitTransaction
endpoint (POST /v1/{prefix}/transactions/commit), requested during review
of apache#10675.

The document proposes backend-capability dispatch: implement a genuinely
atomic commit path for each backend that can support one (batched CAS in a
single DB transaction for JDBC, raw request forwarding for REST), and
return 501 on backends that cannot (HIVE, CUSTOM), gating the
/v1/config advertisement of V1_COMMIT_TRANSACTION on that capability.

Also covers per-table authorization to close the privilege-escalation gap
identified in review, and documents the orphaned-metadata and
lost-response semantics.
@github-actions

Copy link
Copy Markdown

Code Coverage Report

Overall Project 67.81% 🟢
Files changed No Java source files changed -

Module Coverage
aliyun 1.72% 🔴
api 47.82% 🟢
authorization-common 85.96% 🟢
aws 42.04% 🟢
azure 2.47% 🔴
catalog-common 9.92% 🔴
catalog-fileset 79.74% 🟢
catalog-glue 66.91% 🟢
catalog-hive 79.4% 🟢
catalog-jdbc-common 45.7% 🟢
catalog-jdbc-doris 81.8% 🟢
catalog-jdbc-mysql 79.33% 🟢
catalog-jdbc-postgresql 83.39% 🟢
catalog-jdbc-starrocks 79.16% 🟢
catalog-kafka 77.01% 🟢
catalog-lakehouse-generic 59.18% 🟢
catalog-lakehouse-hudi 79.1% 🟢
catalog-lakehouse-iceberg 85.86% 🟢
catalog-lakehouse-paimon 84.23% 🟢
catalog-model 77.72% 🟢
cli 44.5% 🟢
client-java 78.27% 🟢
common 52.05% 🟢
core 82.58% 🟢
filesystem-hadoop3 77.28% 🟢
flink 0.0% 🔴
flink-common 47.09% 🟢
flink-runtime 0.0% 🔴
gcp 14.12% 🔴
hadoop-auth 68.0% 🟢
hadoop-common 12.7% 🔴
hive-metastore-common 53.4% 🟢
iceberg-common 64.65% 🟢
iceberg-rest-server 74.95% 🟢
idp-basic 86.02% 🟢
integration-test-common 0.0% 🔴
jobs 66.17% 🟢
lance-common 20.67% 🔴
lance-rest-server 64.23% 🟢
lineage 53.02% 🟢
optimizer 83.24% 🟢
optimizer-api 21.95% 🔴
server 85.92% 🟢
server-common 76.31% 🟢
spark 28.57% 🔴
spark-common 46.01% 🟢
tencent 69.84% 🟢
trino-connector 40.29% 🟢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Improvement] Implement commitTransaction REST endpoint for Iceberg REST catalog

1 participant