What is FetchSnapshot?
KRaft follower controllers or newly joining brokers download a point-in-time metadata snapshot when they've fallen too far behind to catch up via the log. After a long outage or when joining a mature cluster, a broker fetches the snapshot first, then applies incremental log entries.
Wire Diagram
Response Header · flexible
message_size
int32 · 4B
correlation_id
int32 · 4B
tagged
var
FetchSnapshotResponse v0
ThrottleTimeMs
int32 · 4B
ErrorCode
int16 · 2B
tagged
var
Name
string (compact)
tagged
var
Index
int32 · 4B
ErrorCode
int16 · 2B
Size
int64 · 8B
Position
int64 · 8B
UnalignedRecords
records (compact)
tagged
var
EndOffset
int64 · 8B
Epoch
int32 · 4B
tagged
var
LeaderId
int32 · 4B
LeaderEpoch
int32 · 4B
tagged
var
Schema & Example
Schema { "ThrottleTimeMs": int32, "ErrorCode": int16, "Topics": [{ "Name": string, "Partitions": [{ "Index": int32, "ErrorCode": int16, "SnapshotId": { "EndOffset": int64, "Epoch": int32 }, "CurrentLeader": { "LeaderId": int32, "LeaderEpoch": int32 }, "Size": int64, "Position": int64, "UnalignedRecords": records }] }] }
Example { "ThrottleTimeMs": 0, "ErrorCode": 0, "Topics": [{ "Name": "orders", "Partitions": [{ "Index": 3, "ErrorCode": 0, "SnapshotId": { "EndOffset": 150382, "Epoch": 17 }, "CurrentLeader": { "LeaderId": 1, "LeaderEpoch": 17 }, "Size": 1048576, "Position": 0, "UnalignedRecords": "<binary>" }] }] }