You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by cm...@apache.org on 2019/06/14 18:24:16 UTC
[kafka] branch 2.2 updated: KAFKA-8488: Reduce logging-related
string allocation in FetchSessionHandler
This is an automated email from the ASF dual-hosted git repository.
cmccabe pushed a commit to branch 2.2
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/2.2 by this push:
new 7d75a20 KAFKA-8488: Reduce logging-related string allocation in FetchSessionHandler
7d75a20 is described below
commit 7d75a2085edb3ca70a07371406c1f2387fb931d5
Author: wenhoujx <we...@gmail.com>
AuthorDate: Fri Jun 14 12:24:27 2019 -0400
KAFKA-8488: Reduce logging-related string allocation in FetchSessionHandler
Reviewers: Colin P. McCabe <cm...@apache.org>, Ismael Juma <is...@juma.me.uk>
(cherry picked from commit 35814298e1fa2840f89ef1f40163b2480da28a2b)
(cherry picked from commit 5daf9f18116b251044b03fb0ebe5c96c87f9032c)
---
.../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 30ae65f..5b402bf 100644
--- a/clients/src/main/java/org/apache/kafka/clients/FetchSessionHandler.java
+++ b/clients/src/main/java/org/apache/kafka/clients/FetchSessionHandler.java
@@ -196,8 +196,10 @@ public class FetchSessionHandler {
public FetchRequestData build() {
if (nextMetadata.isFull()) {
- log.debug("Built full fetch {} for node {} with {}.",
- nextMetadata, node, partitionsToLogString(next.keySet()));
+ if (log.isDebugEnabled()) {
+ log.debug("Built full fetch {} for node {} with {}.",
+ nextMetadata, node, partitionsToLogString(next.keySet()));
+ }
sessionPartitions = next;
next = null;
Map<TopicPartition, PartitionData> toSend =
@@ -247,10 +249,12 @@ public class FetchSessionHandler {
sessionPartitions.put(topicPartition, nextData);
added.add(topicPartition);
}
- log.debug("Built incremental fetch {} for node {}. Added {}, altered {}, removed {} " +
- "out of {}", nextMetadata, node, partitionsToLogString(added),
- partitionsToLogString(altered), partitionsToLogString(removed),
- partitionsToLogString(sessionPartitions.keySet()));
+ if (log.isDebugEnabled()) {
+ log.debug("Built incremental fetch {} for node {}. Added {}, altered {}, removed {} " +
+ "out of {}", nextMetadata, node, partitionsToLogString(added),
+ partitionsToLogString(altered), partitionsToLogString(removed),
+ partitionsToLogString(sessionPartitions.keySet()));
+ }
Map<TopicPartition, PartitionData> toSend =
Collections.unmodifiableMap(new LinkedHashMap<>(next));
Map<TopicPartition, PartitionData> curSessionPartitions =