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
Request Header · flexible
message_size
int32 · 4B
api_key
int16 · 2B
api_version
int16 · 2B
correlation_id
int32 · 4B
client_id
string (compact)
tagged
var
FetchSnapshotRequest v0
ClusterId?
string (compact)
ReplicaId
int32 · 4B
MaxBytes
int32 · 4B
tagged
var
Name
string (compact)
tagged
var
Partition
int32 · 4B
CurrentLeaderEpoch
int32 · 4B
Position
int64 · 8B
tagged
var
EndOffset
int64 · 8B
Epoch
int32 · 4B
tagged
var
Schema & Example
Schema { "ClusterId": string?, "ReplicaId": int32, "MaxBytes": int32, "Topics": [{ "Name": string, "Partitions": [{ "Partition": int32, "CurrentLeaderEpoch": int32, "SnapshotId": { "EndOffset": int64, "Epoch": int32 }, "Position": int64 }] }] }
Example { "ClusterId": "dQw4w9WgXcQ", "ReplicaId": -1, "MaxBytes": 65536, "Topics": [{ "Name": "orders", "Partitions": [{ "Partition": 0, "CurrentLeaderEpoch": 12, "SnapshotId": { "EndOffset": 150382, "Epoch": 17 }, "Position": 0 }] }] }