You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by sh...@apache.org on 2022/06/10 04:05:17 UTC

[kafka] branch trunk updated: KAFKA-13917: Avoid calling lookupCoordinator() in tight loop (#12180)

This is an automated email from the ASF dual-hosted git repository.

showuon pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new f8f57960c6 KAFKA-13917: Avoid calling lookupCoordinator() in tight loop (#12180)
f8f57960c6 is described below

commit f8f57960c69fe677b9192b841fb7a0361ef2cc83
Author: Viktor Somogyi-Vass <vi...@gmail.com>
AuthorDate: Fri Jun 10 06:05:05 2022 +0200

    KAFKA-13917: Avoid calling lookupCoordinator() in tight loop (#12180)
    
    Reviewers: Luke Chen <sh...@gmail.com>
---
 .../apache/kafka/clients/consumer/internals/AbstractCoordinator.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java b/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java
index b2f944ad5d..1b7f2374b0 100644
--- a/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java
+++ b/clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java
@@ -1438,12 +1438,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.