You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by da...@apache.org on 2022/07/22 00:04:45 UTC

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

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

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


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

commit 8464e366827d4c3a822beff32b8a0123767cbf0e
Author: Viktor Somogyi-Vass <vi...@gmail.com>
AuthorDate: Fri Jul 22 02:04:39 2022 +0200

    KAFKA-13917: Avoid calling lookupCoordinator() in tight loop (#12417)
    
    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 4d71482562..2b705f347a 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
@@ -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.