Repository navigation
Conversation
…with-assignment-metric Fix `KafkaConsumersWithAssignment` drifting negative Signed-off-by: Ilya Golshtein <igolshtein@altinity.com>
ilejn
force-pushed
the
backport/stable-25.8/113919
branch
from
October 7, 2026 21:42
796943f to
083e956
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
KafkaConsumersWithAssignmentmetric is decremented twice per rebalance revocation but incremented once per assignment, so it drifts down by one per rebalance and eventually reads negative.The revocation callback in
KafkaConsumer::createConsumerdecrements the gauge directly, then callscleanAssignment, which decrements it again. The assignment callback increments it once.Measured on a 26.7.2.59 server up 39 hours with 8 Kafka tables:
KafkaConsumersWithAssignmentKafkaRebalanceAssignmentsKafkaRebalanceRevocations76 - 2 * 68 = -60. Per-tablenum_rebalance_assignmentsandnum_rebalance_revocationsinsystem.kafka_consumerssum to the same 76 and 68.KafkaAssignedPartitionsis decremented only incleanAssignmentand read a correct 21 on the same server.cleanAssignmentis reached by every path that drops an assignment - the revocation callback,moveConsumerand the destructor - so removing the callback's own decrement leaves exactly one decrement per assignment dropped.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix the
KafkaConsumersWithAssignmentmetric drifting negative - it was decremented twice for every consumer group rebalance.(ClickHouse#113919 by @kalavt)
CI/CD Options
Exclude tests:
Regression jobs to run: