Skip to content

25.8 stable backport of #113919: Fix KafkaConsumersWithAssignment drifting negative - #2497

Open
ilejn wants to merge 1 commit into
stable-25.8from
backport/stable-25.8/113919
Open

ilejn wants to merge 1 commit into
stable-25.8from
backport/stable-25.8/113919

Conversation

@ilejn

@ilejn ilejn commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

The KafkaConsumersWithAssignment metric 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::createConsumer decrements the gauge directly, then calls cleanAssignment, 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:

Metric Value
KafkaConsumersWithAssignment -60
KafkaRebalanceAssignments 76
KafkaRebalanceRevocations 68

76 - 2 * 68 = -60. Per-table num_rebalance_assignments and num_rebalance_revocations in system.kafka_consumers sum to the same 76 and 68. KafkaAssignedPartitions is decremented only in cleanAssignment and read a correct 21 on the same server.

cleanAssignment is reached by every path that drops an assignment - the revocation callback, moveConsumer and the destructor - so removing the callback's own decrement leaves exactly one decrement per assignment dropped.

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fix the KafkaConsumersWithAssignment metric drifting negative - it was decremented twice for every consumer group rebalance.
(ClickHouse#113919 by @kalavt)

CI/CD Options

Exclude tests:

  • Fast test
  • Integration Tests
  • Stateless tests
  • Stateful tests
  • Unit tests
  • Performance tests
  • Aarch64 tests
  • All with ASAN
  • All with TSAN
  • All with MSAN
  • All with UBSAN
  • All with Coverage
  • All Regression
  • Disable CI Cache

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • CAS (content-addressed storage; Antalya only)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • OAuth (5m)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • S3 Export (2h)
  • Swarms (30m)
  • Tiered Storage (2h)

@ilejn ilejn self-assigned this Oct 7, 2026
@ilejn ilejn added backport Backport 25.8 25.8 Altinity Stable labels Oct 7, 2026
@ilejn ilejn changed the title 25 stable backport of #113919: Fix KafkaConsumersWithAssignment drifting negative - #113919 25.8 stable backport of #113919: Fix KafkaConsumersWithAssignment drifting negative - #113919 Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Workflow [PR], commit [083e956]

…with-assignment-metric

Fix `KafkaConsumersWithAssignment` drifting negative

Signed-off-by: Ilya Golshtein <igolshtein@altinity.com>
@ilejn
ilejn force-pushed the backport/stable-25.8/113919 branch from 796943f to 083e956 Compare October 7, 2026 21:42
@ilejn ilejn changed the title 25.8 stable backport of #113919: Fix KafkaConsumersWithAssignment drifting negative - #113919 25.8 stable backport of #113919: Fix KafkaConsumersWithAssignment drifting negative Oct 9, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

25.8 25.8 Altinity Stable backport Backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants