Principle:Apache Kafka Partition Load Scheduling
| Knowledge Sources | |
|---|---|
| Domains | Distributed_Systems, Coordinator_Framework |
| Last Updated | 2026-02-09 12:00 GMT |
Overview
An event-driven scheduling mechanism that initiates coordinator state loading when a broker becomes the leader for a coordinator partition.
Description
Partition Load Scheduling is triggered when the Kafka controller assigns partition leadership to a broker. The runtime creates or reuses a CoordinatorContext for the partition and transitions it to the LOADING state. The context holds the coordinator shard, epoch tracking, and state machine. Stale load requests are ignored by comparing the request epoch against the current context epoch.
Usage
Use this principle to understand how coordinators become active. It is the first step in the coordinator lifecycle, triggered automatically by leadership changes.
Theoretical Basis
- Epoch Tracking: Each load request carries a partition epoch. Only requests with a higher epoch than the current context epoch are processed.
- State Machine: The context transitions through states: INITIAL → LOADING → ACTIVE. Transitions from FAILED or INITIAL trigger loading; LOADING and ACTIVE states ignore duplicate load requests.
- Context Creation: A new CoordinatorContext is created if one doesn't exist, including building the CoordinatorShard via the supplier.