Wait for consensus start before answering region requests#17546
Open
Wait for consensus start before answering region requests#17546
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #17546 +/- ##
============================================
+ Coverage 39.80% 39.82% +0.01%
Complexity 312 312
============================================
Files 5142 5147 +5
Lines 347882 348088 +206
Branches 44404 44430 +26
============================================
+ Hits 138489 138618 +129
- Misses 209393 209470 +77 ☔ View full report in Codecov by Sentry. 🚀 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.



Summary
Await/ConditionAwaiter) innode-commonsthat provides a fluent API for waiting until a condition becomes true, with configurable timeout and poll interval.DataNodeContextinner class inDataNodeto expose consensus initialization state (isAllConsensusStarted()), withvolatilevisibility on the underlying flags.DataNodeInternalRPCServiceImpl(create/delete region, change leader, add/remove/delete/reset peer, notify migration) with awaitForConsensusStarted()check that polls up to 30 seconds before rejecting withCONSENSUS_NOT_INITIALIZED.Test plan
Await/ConditionAwaitercovering: already-true condition, condition becomes true, timeout, poll delay, exception ignoring,untilAsserted,forevermode (AwaitTest)createSchemaRegion,createDataRegion,deleteRegion,changeRegionLeaderall reject withCONSENSUS_NOT_INITIALIZEDwhen consensus is not started (ConsensusWaitTest)DataNodeInternalRPCServiceImplTestupdated to pass a mockedDataNodeContextwith consensus started