Iceberg stack 4/11: durable ingestion commit contracts#962
Merged
Conversation
This was referenced Jul 12, 2026
karakanb
force-pushed
the
stack/iceberg-03-sql-requiredness
branch
from
July 13, 2026 11:00
c9dba29 to
ce2b512
Compare
karakanb
force-pushed
the
stack/iceberg-04-durable-contracts
branch
2 times, most recently
from
July 13, 2026 11:30
a6644e1 to
9ba6b03
Compare
karakanb
force-pushed
the
stack/iceberg-03-sql-requiredness
branch
2 times, most recently
from
July 14, 2026 12:35
1a6fe19 to
a0fd6df
Compare
karakanb
force-pushed
the
stack/iceberg-04-durable-contracts
branch
from
July 14, 2026 12:35
9ba6b03 to
b8a05f5
Compare
karakanb
force-pushed
the
stack/iceberg-03-sql-requiredness
branch
4 times, most recently
from
July 16, 2026 09:24
5bc505c to
25d6b68
Compare
karakanb
force-pushed
the
stack/iceberg-04-durable-contracts
branch
from
July 16, 2026 13:38
b8a05f5 to
f9d7228
Compare
karakanb
marked this pull request as ready for review
July 16, 2026 13:38
Contributor
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
pkg/destination/destination.go:192
**`TableWriter` bool return value undocumented**
The new `TableWriter` field is a function type that returns `(bool, error)`, but nothing in the field declaration or surrounding comments explains what `true` vs `false` means. Every future caller (starting with #963) will have to reverse-engineer the intended contract from the implementation rather than the contract.
### Issue 2 of 2
pkg/source/source.go:158-172
**`DurableCommitID any` vs `DataBatchID string` type gap**
`RecordBatchResult.DurableCommitID` and `DurableCheckpointID` are declared `any`, while `CDCStateCommitToken.DataBatchID` — the durable serialized form — is `string`. The strategy layer in #963 will have to do an unchecked type assertion (e.g. `id.(string)`) each time it bridges the two; if a future source sets either field to a non-string, the assertion panics at runtime with no compile-time protection. A narrow helper or a typed alias (even `type DurableID = string`) at the `RecordBatchResult` level would close this gap.
Reviews (1): Last reviewed commit: "define durable ingestion commit contract..." | Re-trigger Greptile |
karakanb
force-pushed
the
stack/iceberg-04-durable-contracts
branch
from
July 16, 2026 14:08
f9d7228 to
df99a99
Compare
Contributor
|
Reviews (2): Last reviewed commit: "define durable ingestion commit contract..." | Re-trigger Greptile |
karakanb
force-pushed
the
stack/iceberg-04-durable-contracts
branch
from
July 16, 2026 14:43
df99a99 to
5f72ed7
Compare
Contributor
|
Reviews (3): Last reviewed commit: "define durable ingestion commit contract..." | Re-trigger Greptile |
iremcaginyurtturk
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Defines the durability and atomic-write contracts needed by the following Iceberg strategy/runtime layers.
It also adds an incarnation-fenced CDC truncate helper. When a managed CDC caller supplies the physical target incarnation, truncation fails closed if the table was dropped and recreated before the operation.
Before and after
Before this layer:
After this layer:
Atomic snapshot attempts have an explicit retry contract: the attempt ID stays stable across retries, and begin/write/publish must be idempotent for that ID, including when publication committed but its success response was lost.
Kafka, NATS, and Redis cumulative watermarks intentionally remain connection-local acknowledgement tokens. They are not exposed as exact durable payload IDs because retry batch boundaries can change; their existing
msg_idprimary-key merge behavior remains the replay-safety mechanism.Stack boundary
This PR intentionally introduces the contracts only. #963 consumes them in the strategy layer: it propagates raw target incarnations through streaming and merge paths, carries exact durable IDs into data and token-only commits, and adds crash/retry coverage. The later Iceberg runtime layer implements the destination-side capabilities.
Previous: #961 (merged) · Next: #963
Validation
make formatmake lintmake testgo test -tags integration ./pkg/destination/postgres -run '^TestLateCDCTargetAtomicCreateAndConditionalTruncate$' -count=1 -v