kafka_consumer: don't report negative offsets as committed - #24938
Open
ian28223 wants to merge 3 commits into
Open
kafka_consumer: don't report negative offsets as committed#24938ian28223 wants to merge 3 commits into
ian28223 wants to merge 3 commits into
Conversation
…NVALID Partitions with no committed offset can surface as OFFSET_BEGINNING (-2) instead of the documented OFFSET_INVALID (-1001) sentinel, which was reported and gauged as a real offset, inflating kafka.consumer_lag. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
evalya-impact-summaryevalya impact analysis |
Contributor
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 5b27b58 | Docs | View more details | Give us feedback! |
ian28223
marked this pull request as ready for review
August 24, 2026 04:15
Contributor
Validation ReportAll 21 validations passed. Show details
|
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.
What does this PR do?
Skips any negative offset returned by
list_consumer_group_offsets, not just the exactOFFSET_INVALID(-1001) sentinel.Motivation
OFFSET_BEGINNING(-2) instead of the documented "no stored offset" sentinelOFFSET_INVALID(-1001). The check only filtered== OFFSET_INVALID, so-2slipped through as a "real" offset:kafka.consumer_offsetwas gauged as-2andkafka.consumer_lagwas inflated tobroker_offset + 2, instead of the partition being skipped.Since a real committed offset is always a non-negative, broker-assigned sequence number, checking
offset < 0coversOFFSET_INVALIDand any other negative logical/sentinel value librdkafka may return in this field.Review checklist (to be filled by reviewers)
qa/requiredif this PR needs QA validation, orqa/skip-qaif it does not. Exactly one of the two is required.backport/<branch-name>label to the PR and it will automatically open a backport PR once this one is merged