Skip to content
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

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public void testElrEnabledByDefault() throws Throwable {
)).
build()
) {
controlEnv.activeController(true);
controlEnv.activeController();
assertTrue(controlEnv.activeController().configurationControl().clusterConfig().containsKey(TopicConfig.MIN_IN_SYNC_REPLICAS_CONFIG));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@ private QuorumControllerTestEnv(
}

QuorumController activeController() throws InterruptedException {
return activeController(false);
}

QuorumController activeController(boolean waitForActivation) throws InterruptedException {
AtomicReference<QuorumController> value = new AtomicReference<>(null);
TestUtils.retryOnExceptionWithTimeout(20000, 3, () -> {
LeaderAndEpoch leader = logEnv.leaderAndEpoch();
Expand All @@ -155,16 +151,14 @@ QuorumController activeController(boolean waitForActivation) throws InterruptedE
}
});

if (waitForActivation) {
try {
// ControllerActivation happens after curClaimEpoch is set, so we need to put something on
// the end of the queue and wait for it to complete before returning the active controller.
value.get()
.appendReadEvent("wait for activation", OptionalLong.empty(), () -> null)
.get(20000, TimeUnit.MILLISECONDS);
} catch (Throwable t) {
throw new RuntimeException("Failed while waiting for controller activation", t);
}
try {
// ControllerActivation happens after curClaimEpoch is set, so we need to put something on
// the end of the queue and wait for it to complete before returning the active controller.
value.get()
.appendReadEvent("wait for activation", OptionalLong.empty(), () -> null)
.get(20000, TimeUnit.MILLISECONDS);
} catch (Throwable t) {
throw new RuntimeException("Failed while waiting for controller activation", t);
}

return value.get();
Expand Down