From 28058608f13d2a5bbc0da2af344b92d3acad7e26 Mon Sep 17 00:00:00 2001 From: Jeff Jirsa Date: Tue, 24 Apr 2018 23:15:13 -0700 Subject: [PATCH] Remove string formatting lines from BufferPool hot path Patch by Jeff Jirsa; Reviewed by Marcus Eriksson for CASSANDRA-14416 --- CHANGES.txt | 1 + src/java/org/apache/cassandra/utils/memory/BufferPool.java | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 3e8f687455..e63e5f3e94 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 3.11.3 + * Remove string formatting lines from BufferPool hot path (CASSANDRA-14416) * Update metrics to 3.1.5 (CASSANDRA-12924) * Detect OpenJDK jvm type and architecture (CASSANDRA-12793) * Don't use guava collections in the non-system keyspace jmx attributes (CASSANDRA-12271) diff --git a/src/java/org/apache/cassandra/utils/memory/BufferPool.java b/src/java/org/apache/cassandra/utils/memory/BufferPool.java index 20e600630c..f9ec40c3d8 100644 --- a/src/java/org/apache/cassandra/utils/memory/BufferPool.java +++ b/src/java/org/apache/cassandra/utils/memory/BufferPool.java @@ -265,8 +265,7 @@ public class BufferPool if (cur + MACRO_CHUNK_SIZE > MEMORY_USAGE_THRESHOLD) { noSpamLogger.info("Maximum memory usage reached ({}), cannot allocate chunk of {}", - FBUtilities.prettyPrintMemory(MEMORY_USAGE_THRESHOLD), - FBUtilities.prettyPrintMemory(MACRO_CHUNK_SIZE)); + MEMORY_USAGE_THRESHOLD, MACRO_CHUNK_SIZE); return false; } if (memoryUsage.compareAndSet(cur, cur + MACRO_CHUNK_SIZE)) @@ -284,9 +283,7 @@ public class BufferPool noSpamLogger.error("Buffer pool failed to allocate chunk of {}, current size {} ({}). " + "Attempting to continue; buffers will be allocated in on-heap memory which can degrade performance. " + "Make sure direct memory size (-XX:MaxDirectMemorySize) is large enough to accommodate off-heap memtables and caches.", - FBUtilities.prettyPrintMemory(MACRO_CHUNK_SIZE), - FBUtilities.prettyPrintMemory(sizeInBytes()), - oom.toString()); + MACRO_CHUNK_SIZE, sizeInBytes(), oom.toString()); return false; }