Skip to content

feat: send Idempotency-Key on REST mutations when the server advertises it - #4310

Open
YuangGao wants to merge 1 commit into
apache:mainfrom
YuangGao:feat/rest-idempotency-key
Open

YuangGao wants to merge 1 commit into
apache:mainfrom
YuangGao:feat/rest-idempotency-key

Conversation

@YuangGao

@YuangGao YuangGao commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Closes #4290

Rationale for this change

  • A REST server can advertise idempotency-key-lifetime, after which clients send an Idempotency-Key (UUIDv7) on mutations and reuse it on retry, so a retried commit can't apply twice. PyIceberg sent no key and never retried POST.
  • With the lifetime advertised, each mutation now carries a fresh key, and the rest.client.* retry policy also covers POST, reusing the key across retries, as Java's RESTSessionCatalog does.
  • The lifetime itself isn't enforced: urllib3 retries are bounded and finish well within typical lifetimes.

Are these changes tested?

  • test_rest.py — mutations carry a UUIDv7 key only when advertised, a different one per operation, and reads carry none; a POST retried after a 503 reuses its key.

Are there any user-facing changes?

  • Against servers that advertise idempotency-key-lifetime, mutations send Idempotency-Key and POST is retried under rest.client.*.

This branch has not been deployed

No deployments
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.

REST catalog: send Idempotency-Key on mutations and retry safely when the server advertises it

1 participant