Skip to content

[server] Speed up controlled shutdown leader migration with batch ZooKeeper operations #3653

Description

@swuferhong

Search before asking

  • I searched in the issues and found nothing similar.

Motivation

During controlled shutdown, the coordinator needs to migrate bucket leaders away from the shutting-down tablet server.

Currently this path processes leader buckets one by one. Each bucket does synchronous ZooKeeper read/update of LeaderAndIsr, which becomes expensive when a tablet server owns many leader buckets. In one test with 10,131 leader buckets, controlled shutdown leader state changes took about 113s, while dispatching the batched tablet server requests only took 22ms. The main cost was ZooKeeper reads and updates.

We can improve this by batching LeaderAndIsr reads and updates for the controlled shutdown path, while preserving the existing leader election semantics. The optimized path should be limited to controlled shutdown, and should fall back to the existing individual update path when batch reads are incomplete or batch updates fail.

Solution

No response

Anything else?

No response

Willingness to contribute

  • I'm willing to submit a PR!

Activity

  1. self-assigned this
    on Jul 14, 2026
  2. added this to the v1.0 milestone on Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions