ADR-0243: A log transfer is a cursor over pinned offsets, at least once
- Status: accepted
- Date: 2026-12-05
- Deciders: maintainers
- Change:
openspec/changes/46-kafka-dead-letters-transfer-bulk-tail
Context
Transfers between queues (ADR-0097) stage messages on the source and deduplicate. A Kafka topic cannot give a record back, and OpenBroker 0.16.0 reproduces a record exactly through a Kafka sender and declares copy on topics and partitions. Operators need to copy records between topics and clusters, and to re-drive dead letters, with the same previewed, held and audited run.
Decision
TransferControllerdispatches on whether the source kind is partitioned toLogTransferServiceandLogCopyRunner; the queue engine is untouched. A run has anengine(RELAY or LOG) and, for a log, apurpose(COPY or REDRIVE).- The runner always relays, even within one cluster: a browse on the source connection by partition and offset, an idempotent at-least-once send to the target of the record as it was read. Batches close at 500 records or 8 MiB, take a permit on both clusters, and are checked against what the operator still holds.
- Each partition has a cursor (
transfer_log_cursor) that advances only after the target acknowledged the batch. End offsets are pinned at preview, so the selection is frozen. A batch is marked in doubt before it is sent; a crash leaves at most one batch, which is sent again on resume and reported as "up to N possibly duplicated". - Records gone since the preview (retention, compaction) are counted as missing and the run ends PARTIAL; a missing target topic is a refusal and the topic is never created; a cluster that goes down interrupts the run, which can be resumed; a missing permission stops the run at that batch and names the principal. A log run cannot be returned.
- Permissions:
message:readon the source andmessage:produceon the target, checked at preview, at execute and before every batch; a copy to a topic other than the record's origin, which includes every cross-cluster copy, needs unmasked read. The gate operation istransfer.execute(version 2). Audit carries the spans and end offsets, never keys, values or header values, and a cross-cluster run writes one event per cluster.
Consequences
- Copy and re-drive reuse the previewed, held, audited run the operator already knows.
- Delivery is at least once with one batch in doubt, a limit the run states and does not hide; it is not exactly once.
- Cross-connection exactness is asserted for Kafka only.
Alternatives considered
- Extend the queue engine. It depends on staging and ids that a log does not have.
- Exactly-once with transactions. Not available across two clusters.
- Create the target topic. Partition counts and configuration are choices an operator makes, not a run.