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

lianetm 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 7f1ec08519c MINOR: add missing log enabled check  (#22629)
7f1ec08519c is described below

commit 7f1ec08519c5f62054d41be89deb8c49d35b5f98
Author: Lianet Magrans <[email protected]>
AuthorDate: Fri Jun 19 22:32:32 2026 -0400

    MINOR: add missing log enabled check  (#22629)
    
    Add check to avoid unnecessary evals on this path (consistent with all
    other debug logs on this class)
    
    Reviewers: Manikumar Reddy <[email protected]>, Bill Bejeck
    <[email protected]>
---
 .../org/apache/kafka/clients/FetchSessionHandler.java    | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git 
a/clients/src/main/java/org/apache/kafka/clients/FetchSessionHandler.java 
b/clients/src/main/java/org/apache/kafka/clients/FetchSessionHandler.java
index ab108ceab73..cd781a1caf6 100644
--- a/clients/src/main/java/org/apache/kafka/clients/FetchSessionHandler.java
+++ b/clients/src/main/java/org/apache/kafka/clients/FetchSessionHandler.java
@@ -528,17 +528,21 @@ public class FetchSessionHandler {
         if (response.error() != Errors.NONE) {
             if (response.error() == Errors.FETCH_SESSION_ID_NOT_FOUND) {
                 // Session does not exist on the broker anymore. Recoverable 
and self-healing, the client re-sends a full fetch request.
-                log.debug("Node {} returned a {} error; the fetch session {} 
was likely evicted from the broker's " +
-                    "fetch session cache. Re-sending a full fetch request to 
establish a new session.",
-                    node, response.error(), nextMetadata.sessionId());
+                if (log.isDebugEnabled()) {
+                    log.debug("Node {} returned a {} error; the fetch session 
{} was likely evicted from the broker's " +
+                        "fetch session cache. Re-sending a full fetch request 
to establish a new session.",
+                        node, response.error(), nextMetadata.sessionId());
+                }
                 nextMetadata = FetchMetadata.INITIAL;
             } else {
                 // Other fetch-session errors (e.g. 
INVALID_FETCH_SESSION_EPOCH, FETCH_SESSION_TOPIC_ID_ERROR) are
                 // also recoverable and self-healing: the existing session is 
closed and a new one is re-established
                 // with a full fetch.
-                log.debug("Node {} was unable to process the fetch request 
with {}: {}. " +
-                    "Re-sending a full fetch request, which closes the 
existing session on the broker and establishes a new one.",
-                    node, nextMetadata, response.error());
+                if (log.isDebugEnabled()) {
+                    log.debug("Node {} was unable to process the fetch request 
with {}: {}. " +
+                        "Re-sending a full fetch request, which closes the 
existing session on the broker and establishes a new one.",
+                        node, nextMetadata, response.error());
+                }
                 nextMetadata = nextMetadata.nextCloseExistingAttemptNew();
             }
             return false;

Reply via email to