Retry consuming-segment stream init on the consumer thread - #19370
Open
Vamsi-klu wants to merge 1 commit into
Open
Retry consuming-segment stream init on the consumer thread#19370Vamsi-klu wants to merge 1 commit into
Vamsi-klu wants to merge 1 commit into
Conversation
First create used the no-policy Kafka path on the Helix constructor (~10s then OFFLINE). apache#17062 already retries recreate on the consumer thread. Apply the same policy to first create so a transient Kafka/DNS failure does not leave a partition under-replicated until natural flush. Co-authored-by: Cursor <cursoragent@cursor.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #19370 +/- ##
============================================
+ Coverage 67.44% 67.46% +0.02%
Complexity 1430 1430
============================================
Files 3485 3485
Lines 223874 223899 +25
Branches 35300 35308 +8
============================================
+ Hits 150987 151051 +64
+ Misses 60890 60852 -38
+ Partials 11997 11996 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Problem
A retryable Kafka/DNS failure during consuming-segment init still runs on the Helix state-transition thread. That path uses Kafka's short 5x2s retry, then marks the replica OFFLINE after about 10s. Healthy replicas keep consuming. The partition stays under-replicated until the next natural flush.
#17062 already retries mid-consume recreate on the consumer thread with
CONSUMER_RECREATE_RETRY_POLICY(about 8 minutes). First create did not use that path.#19083 tried a controller-side auto force-commit. Review feedback was that one bad server must not force healthy replicas to commit, and that the remaining hole is this init path, not another default-off controller flag.
What I did
Move first
makeStreamConsumer("Starting")from the Helix constructor ontoPartitionConsumer.run(), after the ready-wait and consumer semaphore. First create now uses the sameCONSUMER_RECREATE_RETRY_POLICYas mid-consume recreate (10 attempts, 1s, factor 2).No force-commit. No new controller config. #17754 (
controller.realtime.segment.partialOfflineReplicaRepairEnabled, default false) is unchanged. All-OFFLINE recreate is unchanged.How
postStopConsumedMsg/ ERROR / OFFLINE path.stop()for CONSUMING to ONLINE keeps a just-created consumer so catchup can use it. Offload during in-flight create closes the uninstalled client.checkpointa closed instance (default is identity).Impact
A transient Kafka/DNS blip on one server retries on that server's consumer thread instead of going OFFLINE after about 10s. Other replicas are not force-committed. Brokers do not start preferring a replica that is hours behind.
Helix state-transition threads are not blocked for the long retry window.
Not in this PR
createPartitionMetadataProvider("Starting")still runs on the Helix constructor. For Kafka that opens a metadata-provider client on the short 5x2s path. A retryable DNS failure there can still OFFLINE a replica after about 10s. Fetch fallbacks already exist for offset lookup; provider construction itself can still throw.Testing
RealtimeSegmentDataManagerTest: 33 tests, 0 failures.CONSUMER_RECREATE_RETRY_POLICYPlease tag
bugandtesting. Norelease-notes(no new config).Related
cc @noob-se7en
Was generative AI tooling used to co-author this PR?