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