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.
| Version | Kafka | Changes |
|---|---|---|
| FetchSnapshotRequest | ||
| v0 | 2.8 | + ClusterId string+ ReplicaId int32+ MaxBytes int32+ Topics []TopicSnapshot+ Name string+ Partitions []PartitionSnapshot+ Partition int32+ CurrentLeaderEpoch int32+ SnapshotId SnapshotId+ EndOffset int64+ Epoch int32+ Position int64~ Flexible encoding enabled FLEXIBLE |
| v1 | 3.9 | + ReplicaDirectoryId uuidadds replica directory id (KIP-853) |
| FetchSnapshotResponse | ||
| v0 | 2.8 | + ThrottleTimeMs int32+ ErrorCode int16+ Topics []TopicSnapshot+ Name string+ Partitions []PartitionSnapshot+ Index int32+ ErrorCode int16+ SnapshotId SnapshotId+ EndOffset int64+ Epoch int32+ CurrentLeader LeaderIdAndEpoch+ LeaderId int32+ LeaderEpoch int32+ Size int64+ Position int64+ UnalignedRecords records~ Flexible encoding enabled FLEXIBLE |
| v1 | 3.9 | + NodeEndpoints []NodeEndpoint+ NodeId int32+ Host string+ Port uint16adds leader endpoint (KIP-853) |