KAFKA-13917: Avoid calling lookupCoordinator() in tight loop (#12417)

Reviewers: Luke Chen <showuon@gmail.com>
This commit is contained in:
Viktor Somogyi-Vass 2022-07-22 02:04:39 +02:00 committed by GitHub
parent cb14b100ad
commit 8464e36682
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -1443,12 +1443,11 @@ public abstract class AbstractCoordinator implements Closeable {
// clear the future so that after the backoff, if the hb still sees coordinator unknown in
// the next iteration it will try to re-discover the coordinator in case the main thread cannot
clearFindCoordinatorFuture();
// backoff properly
AbstractCoordinator.this.wait(rebalanceConfig.retryBackoffMs);
} else {
lookupCoordinator();
}
// backoff properly
AbstractCoordinator.this.wait(rebalanceConfig.retryBackoffMs);
} else if (heartbeat.sessionTimeoutExpired(now)) {
// the session timeout has expired without seeing a successful heartbeat, so we should
// probably make sure the coordinator is still healthy.