# org.apache.kafka.common.errors.CoordinatorLoadInProgressException: 协调器正在加载，无法处理请求

- **ID:** `kafka/coordinator-load-in-progress`
- **领域:** kafka
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 85%

## 根因

在领导者选举或代理重启后，组或事务协调器仍从内部主题（如__consumer_offsets）加载状态。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Kafka 3.3.0 | active | — | — |
| Kafka 3.4.0 | active | — | — |
| Kafka 3.5.0 | active | — | — |

## 解决方案

1. ```
   Wait for coordinator to finish loading; check broker logs for 'Finished loading offsets from __consumer_offsets'.
Command to monitor:
kafka-consumer-groups --bootstrap-server localhost:9092 --group my-group --describe --members --verbose
If loading takes too long, increase offsets.load.buffer.size in broker config:
echo "offsets.load.buffer.size=10485760" >> config/server.properties
kafka-server-start.sh config/server.properties
   ```
2. ```
   Use exponential backoff in consumer retry logic to avoid overwhelming the coordinator.
Code example:
int retries = 0;
while (retries < 5) {
  try {
    consumer.poll(Duration.ofMillis(1000));
    break;
  } catch (CoordinatorLoadInProgressException e) {
    Thread.sleep((long) Math.pow(2, retries) * 1000);
    retries++;
  }
}
   ```

## 无效尝试

- **Restart the consumer application immediately** — Consumer restart does not speed up coordinator loading; it only retries the same request. (90% 失败率)
- **Delete __consumer_offsets topic to reset state** — Deleting internal topics corrupts the cluster and causes data loss for all consumer groups. (99% 失败率)
- **Reduce offsets.topic.num.partitions to 1** — Changing partition count requires cluster restart and does not fix loading speed. (80% 失败率)
