From 507c4e41a6e2e0f80d9c2876c61afe5543f5aa03 Mon Sep 17 00:00:00 2001 From: Federico Valeri Date: Wed, 25 Mar 2026 09:29:30 +0100 Subject: [PATCH] KAFKA-20354: Add missing Control Batch types in documentation This patch adds missing Control Batch types in the documentaion. Signed-off-by: Federico Valeri --- docs/implementation/message-format.md | 124 +++++++++++++++++++++++++- 1 file changed, 120 insertions(+), 4 deletions(-) diff --git a/docs/implementation/message-format.md b/docs/implementation/message-format.md index d93cc025b32c5..504b421cccb2c 100644 --- a/docs/implementation/message-format.md +++ b/docs/implementation/message-format.md @@ -71,15 +71,131 @@ Compaction may also modify the baseTimestamp if the record batch contains record ### Control Batches -A control batch contains a single record called the control record. Control records should not be passed on to applications. Instead, they are used by consumers to filter out aborted transactional messages. +A control batch contains a single record called the control record. Control records should not be returned to applications. Instead, they are used by consumers to filter out aborted transactional messages, and by the KRaft implementation for its protocol metadata. -The key of a control record conforms to the following schema: - +The key of a control record conforms to the following schema: version: int16 (current version is 0) type: int16 (0 indicates an abort marker, 1 indicates a commit) -The schema for the value of a control record is dependent on the type. The value is opaque to clients. +The following control record types are currently defined: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +Type + + +Name + + +Description +
+ +0 + + +ABORT + + +Marks a transaction as aborted. +
+ +1 + + +COMMIT + + +Marks a transaction as committed. +
+ +2 + + +LEADER_CHANGE + + +Records a KRaft leader change. +
+ +3 + + +SNAPSHOT_HEADER + + +Marks the beginning of a KRaft snapshot. +
+ +4 + + +SNAPSHOT_FOOTER + + +Marks the end of a KRaft snapshot. +
+ +5 + + +KRAFT_VERSION + + +Records the finalized kraft.version supported by all replicas. +
+ +6 + + +KRAFT_VOTERS + + +Records the set of voters at a specific offset. +
+ +Types 0 and 1 are used as end-of-transaction markers for the transactional messaging protocol. Types 2 through 6 are used internally by the KRaft consensus protocol. The schema of the value in the control record is dependent on the type. The value is opaque to clients. ## Record