DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
__transaction_state: schema
Flow
...
— Regular Consumer
...
Group
- Producer writes to output topic
- Source Component:
TransactionManager(Client) - Action: Sends
AddPartitionsToTxn("output-A-0")toTxnCoord. - State Change:
TxnCoordrecordsparticipants = {output-A-0}in__transaction_state.
- Source Component:
- Producer calls sendOffsetsToTransaction("my-group")
- Source Component:
TransactionManager(Client) &TransactionCoordinator(Broker Core) - Action: Sends
AddOffsetsToTxn("my-group")toTxnCoord. - Execution:
TxnCoordcomputeshash("my-group") = (let's say) 7. - State Change: Records
participants = {output-A-0, __consumer_offsets-7}in__transaction_state.
- Source Component:
- Producer commits
- Source Component:
TransactionCoordinator(Broker Core) - Execution: Reads participants from
__transaction_stateand resolves brokers viaMetadataCache:output-A-0— > Broker 3__consumer_offsets-7---→ Broker 4
- Action: Sends
WriteTxnMarkersto Broker 3 AND Broker 4.
- Source Component:
- Each broker writes a control batch to its log
- Source Component:
KafkaApis&GroupCoordinator(Broker Core) - Execution:
- Broker 3: Appends
COMMITbatch tooutput-A-0log (makes records visible toread_committedconsumers). - Broker 4: Appends
COMMITbatch to__consumer_offsets-7log (makes staged offsets visible toGroupCoordinator).
- Broker 3: Appends
- Source Component:
Flow — Share Group (THIS KIP)
- producer.send("output-A", record)
- Source Component:
TransactionManager(Client) - Action: Sends
AddPartitionsToTxnRequest(["output-A-0"]). - State Change: Updates local state to
TransactionMetadata.topicPartitions = {output-A-0}.
- Source Component:
- producer.sendShareAcknowledgementsToTransaction(acks, meta)
- Source Component:
TransactionManager(Client) ---→KafkaApis(Broker Core) - Action: Sends
TxnShareAcknowledgeRequestto Broker 5 (theSharePartitionleader - lets say it is broker 5). - Broker Execution:
KafkaApisintercepts the request and performs two background operations:- Resolves the state partition:
shareCoordinatorPartition = (__share_group_state, partitionFor(groupId)). - Calls
txnCoordinator.handleAddPartitionsToTransactionto dynamically register__share_group_state-Nin__transaction_state.
- Resolves the state partition:
- State Change:
TransactionMetadatanow tracks bothtopicPartitions = {output-A-0, __share_group_state-N}. - Staging Phase: Only on success,
SharePartitionManagerstages the transactional acknowledgements, transitioning the internalInFlightStatetoTX_PENDING.
- Source Component:
- producer.commitTransaction()
- Source Component: Client ------->
TransactionCoordinator(Broker Core) - Action: Sends
EndTxnRequest(COMMIT). - Execution:
TxnCoordreads the topic partitions from state and resolves the physical leaders viaMetadataCache:output-A-0--------> Broker 3__share_group_state-N-----→ Broker 5
- Action: Dispatches
WriteTxnMarkersto both brokers.
- Source Component: Client ------->
- Each broker handles the transaction markers
- Execution on Broker 3 (Output Side):
- Appends the
COMMITcontrol batch to theoutput-A-0log.
- Appends the
- Execution on Broker 5 (Share Side):
- Appends the
COMMITcontrol batch to the__share_group_state-Nlog. - Fires the KIP-1289 hook: Triggers
sharePartitionManager.applyTxnMarker(COMMIT). - Scans the internal
partitionCache, finds the matchingTX_PENDINGflight states, and commits them toACKNOWLEDGED.
- Appends the
- Execution on Broker 3 (Output Side):
- Transaction Completion
- Action: Both brokers return successful ACKs back to
TxnCoord. - State Change:
TxnCoordtransitions the state toCOMPLETE_COMMIT. - Result: The client-side blocking
producer.commitTransaction()call returns successfully.
- Action: Both brokers return successful ACKs back to
State machine additions:
- New transient state TX_PENDING
- On WriteTxnMarkers commit: TX_PENDING(ACCEPT) → ACKNOWLEDGED; same for RELEASE and REJECT.
- On WriteTxnMarkers abort: TX_PENDING(*) → back to ACQUIRED (lock continues; consumer can retry the work).
...