Repository navigation
Fix polling interval adjustment logic when KafkaConsumer has no partition assignment - #100431
Conversation
…tion assignment waited_for_assignment was not reset on partition assign, causing the shortened poll interval to persist even after a successful assignment. This also increases the fetch rate, leading to more empty poll results and smaller data parts due to fewer records per fetch, which increases merge overhead and degrades performance. Reset the counter on assign to restore the configured poll interval.
08e3662 to
1ee2bf3
Compare
|
Hi @filimonov , could you please take a look when you have time? |
azat
left a comment
There was a problem hiding this comment.
Thanks, sounds reasonable
Can you please share some numbers how it can affect?
|
Workflow [PR], commit [7ba9a55] Summary: ❌
AI ReviewSummaryThis PR fixes Final Verdict
|
Thanks for the reply, I compared the metrics between the time when this issue occurred and after recovery via Kafka table DETACH/ATTACH. kafka_flush_interval_ms is 15000, other is default.
Overall throughput stayed effectively unchanged, while significantly reducing insert frequency, active parts, merge pressure, and resident memory usage. |
LLVM Coverage Report
Changed lines: 100.00% (4/4) · Uncovered code |
azat
left a comment
There was a problem hiding this comment.
@sugaf1204 thanks for the numbers, looks good (I've also updated the entry to "Improvement", since bug-fix is a very strong label, and improvement suits better here)
0050dcc
…for-assignment-on-assign Fix polling interval adjustment logic when KafkaConsumer has no partition assignment
waited_for_assignment was not reset on partition assign, causing the shortened poll interval to persist even after a successful assignment.
This also increases the fetch rate, leading to more empty poll results and smaller data parts due to fewer records per fetch, which increases merge overhead and degrades performance.
Reset the counter on assignto restore the configured poll interval.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixes Kafka table engine consumers that kept using a short poll interval after partition assignment, so they return to the configured
kafka_poll_timeout_msand avoid excessive empty polls, smaller inserted parts, and extra merge overhead after rebalances.Documentation entry for user-facing changes
Note
Medium Risk
Touches Kafka consumer group rebalance/assignment handling; although the code change is small, it affects polling behavior and could impact ingestion performance or latency if incorrect.
Overview
Fixes a Kafka engine bug where consumers that previously had no partition assignment could keep using the shortened fallback poll timeout even after an assignment was later received, by resetting
waited_for_assignmentin the assignment callback.Adds an integration test that simulates broker unavailability and subsequent recovery, asserting the consumer reaches an assignment and that empty polls after recovery take roughly the configured
kafka_poll_timeout_ms(not the 50ms fallback).Reviewed by Cursor Bugbot for commit 7ba9a55. Bugbot is set up for automated code reviews on this repo. Configure here.
Version info
26.6.1.114