Altinity / Altinity/clickhouse-operator

Kafka rebalances during the rolling restart

Open
#1,642 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
2.6k
Forks
574
Avg merge
8d 6h
Merged PRs (30d)
6

Description

If you have a lot of nodes which run a lot of Kafka tables the rolling restart can lead to a terrible sequence of the rebalances.

node1 going down
every kafka table on that node get shutting down
that triggers rebalances in consumer groups
rebalance is 'stop the world' thing in clickhouse
so all other replicas pauses the consumtion and start the relabalnce protocol to redestribute the topics / partitions
it usually takes seconds to dozen of seconds till they will get the new assignment
in the meanwhile the node1 get back online and trigger one more rebalance

then the situation repeats for other nodes.

Possible solution:

let's introduce some setting like stopSteamingTablesDuringRestarts
when enabled clickhouse-operator before restarting the first node should
do

DETACH TABLE db.table ON CLUSTER '{cluster}' PERMANENTLY

for every table with engine Kafka (maybe also RabbitMQ? and others)
and store in the state that the table were detached (wouldn't it be too much?)
after that do normal reconsile / restarts.

in cases or success / failure do ATTACH TABLE for every table stored in the state.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the rolling-restart flow in the ClickHouse operator and how Kafka tables are identified and managed. Define the restart behavior around DETACH TABLE and ATTACH TABLE, including state handling for success and failure, and verify that rebalances are avoided during the rolling restart.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kafka, kubernetes
Domain
distributed-systems, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.