-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KAFKA-18844: Fix flaky QuorumControllerTest.testBalancePartitionLeaders() #18997
base: trunk
Are you sure you want to change the base?
Conversation
This is related to #18845, thanks for the quick fix! |
We tried to remove these defaults as part of #18845 - looks like I missed this one. Can you try removing the default? Is that an easy change or does it cause a lot of issues? |
I think we can't remove the default one. Each variable get default value if it's null. Or do you mean that trying to set kafka/metadata/src/main/java/org/apache/kafka/controller/FeatureControlManager.java Lines 96 to 111 in 8f13e7c
|
Yes, if it's mandatory, then we should set it in the constructor. Any issues doing that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FrankYang0529 : Thanks for the PR.
Regarding FeatureControlManager.metadataVersion
, it's bootstrapped from the bootstrap file or the log. Any test that depends on it should wait for the bootstrap to complete. So, it does seem reasonable to initialize it to null. @cmccabe : What do you think?
@@ -753,6 +753,10 @@ public void testBalancePartitionLeaders() throws Throwable { | |||
QuorumController active = controlEnv.activeController(); | |||
Map<Integer, Long> brokerEpochs = new HashMap<>(); | |||
|
|||
TestUtils.waitForCondition(() -> | |||
active.featureControl().finalizedFeatures(Long.MAX_VALUE).featureMap().get(MetadataVersion.FEATURE_NAME) == SIMPLE_BOOTSTRAP.metadataVersion().featureLevel(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we need to wait for QuorumController to fully bootstrap before doing the remaining test, it seems that we should just call controlEnv.activeController(true)
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…rs() Signed-off-by: PoAn Yang <payang@apache.org>
0f8190a
to
2544030
Compare
When we initialize
FeatureControlManager
inQuorumController
[0], we don't setbootstrapMetadata
for it, so it useMetadata.latestProduction()
[1]. In the test case, we useIBP_3_7_IV0
asbootstrapMetadata
[2]. When initializingQuorumController
, it takes time to replay record to overwriteFeatureControlManager#metadataVersion
. If we addThread.sleep(1000L)
beforemetadataVersion.set(mv)
[3], we can reproduce the flaky test steadily.I'm not sure whether setting
bootstrapMetadata
toFeatureControlManager
is correct, so I fix the case by waitingmetadataVersion
is overwrote.[0]
kafka/metadata/src/main/java/org/apache/kafka/controller/QuorumController.java
Lines 1536 to 1541 in 8f13e7c
[1]
kafka/metadata/src/main/java/org/apache/kafka/controller/FeatureControlManager.java
Line 57 in 8f13e7c
[2]
kafka/metadata/src/test/java/org/apache/kafka/controller/QuorumControllerTest.java
Lines 177 to 178 in 8f13e7c
[3]
kafka/metadata/src/main/java/org/apache/kafka/controller/FeatureControlManager.java
Lines 371 to 379 in 8f13e7c
Committer Checklist (excluded from commit message)