This is an automated email from the ASF dual-hosted git repository.
rmattingly pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/master by this push:
new f14c3ac7e36 HBASE-29099 Avoid expensive BlockCacheKey.toString() calls
when tracing is disabled (#6642)
f14c3ac7e36 is described below
commit f14c3ac7e36874c4189c0c46ff74cf723793041c
Author: jbewing <[email protected]>
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 <[email protected]>
---
.../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 64215333371..33b761645de 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
@@ -1289,11 +1289,15 @@ 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 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.