What is BrokerHeartbeat?
Each broker sends this periodically to the KRaft controller to prove liveness and report metadata replication progress. A broker that stops heartbeating gets fenced and its leadership migrated away. The highestMetadataOffset tells the controller how caught up the broker is before unfencing after a restart.
| Version | Kafka | Changes |
|---|---|---|
| BrokerHeartbeatRequest | ||
| v0 | 2.8 | + BrokerId int32+ BrokerEpoch int64+ CurrentMetadataOffset int64+ WantFence bool+ WantShutDown bool~ Flexible encoding enabled FLEXIBLE |
| v1 | 3.7 | + OfflineLogDirs []uuidadds the OfflineLogDirs flexible field |
| v2 | + CordonedLogDirs []uuidadds the CordonedLogDirs flexible field | |
| BrokerHeartbeatResponse | ||
| v0 | 2.8 | + ThrottleTimeMs int32+ ErrorCode int16+ IsCaughtUp bool+ IsFenced bool+ ShouldShutDown bool~ Flexible encoding enabled FLEXIBLE |
| v1 | 3.7 | is the same as version 0 (new field in request). |
| v2 | is the same as version 0 (new field in request). | |