You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by rm...@apache.org on 2025/01/28 20:17:35 UTC

(hbase) branch HBASE-29099-branch-2.6 created (now ef3d8b5f6b3)

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

rmattingly pushed a change to branch HBASE-29099-branch-2.6
in repository https://gitbox.apache.org/repos/asf/hbase.git


      at ef3d8b5f6b3 HBASE-29099 Avoid expensive BlockCacheKey.toString() calls when tracing is disabled (#6642)

This branch includes the following new commits:

     new ef3d8b5f6b3 HBASE-29099 Avoid expensive BlockCacheKey.toString() calls when tracing is disabled (#6642)

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(hbase) 01/01: HBASE-29099 Avoid expensive BlockCacheKey.toString() calls when tracing is disabled (#6642)

Posted by rm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rmattingly pushed a commit to branch HBASE-29099-branch-2.6
in repository https://gitbox.apache.org/repos/asf/hbase.git

commit ef3d8b5f6b3f789a9504b60cbe928cb6f83c9647
Author: jbewing <jb...@live.com>
AuthorDate: Tue Jan 28 15:14:03 2025 -0500

    HBASE-29099 Avoid expensive BlockCacheKey.toString() calls when tracing is disabled (#6642)
    
    Signed-off-by: Ray Mattingly <rm...@apache.org>
---
 .../main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java
index ace662414f4..b6a06104307 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java
@@ -1291,13 +1291,17 @@ public abstract class HFileReaderImpl implements HFile.Reader, Configurable {
 
     BlockCacheKey cacheKey =
       new BlockCacheKey(path, dataBlockOffset, this.isPrimaryReplicaReader(), expectedBlockType);
-    Attributes attributes = Attributes.of(BLOCK_CACHE_KEY_KEY, cacheKey.toString());
 
     boolean cacheable = cacheBlock && cacheIfCompactionsOff();
 
     boolean useLock = false;
     IdLock.Entry lockEntry = null;
     final Span span = Span.current();
+    // BlockCacheKey#toString() is quite expensive to call, so if tracing isn't enabled, don't
+    // record
+    Attributes attributes = span.isRecording()
+      ? Attributes.of(BLOCK_CACHE_KEY_KEY, cacheKey.toString())
+      : Attributes.empty();
     try {
       while (true) {
         // Check cache for block. If found return.