You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by wc...@apache.org on 2025/05/19 11:59:46 UTC
(hbase) branch master updated: [ADDENDUM] HBASE-29288 Avoid adding new blocks during prefetch if usage is greater than accept factor (#6965) (#6990)
This is an automated email from the ASF dual-hosted git repository.
wchevreuil 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 b21ba71f738 [ADDENDUM] HBASE-29288 Avoid adding new blocks during prefetch if usage is greater than accept factor (#6965) (#6990)
b21ba71f738 is described below
commit b21ba71f73881336345fd5dd7d647910b3058e05
Author: Wellington Ramos Chevreuil <wc...@apache.org>
AuthorDate: Mon May 19 12:59:39 2025 +0100
[ADDENDUM] HBASE-29288 Avoid adding new blocks during prefetch if usage is greater than accept factor (#6965) (#6990)
Signed-off-by: Peter Somogyi <ps...@apache.org>
---
.../org/apache/hadoop/hbase/io/hfile/HFilePreadReader.java | 7 +++++--
.../hbase/io/hfile/bucket/TestPrefetchWithBucketCache.java | 11 ++++++++---
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFilePreadReader.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFilePreadReader.java
index 6266be6cbcc..533021a428d 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFilePreadReader.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFilePreadReader.java
@@ -97,6 +97,9 @@ public class HFilePreadReader extends HFileReaderImpl {
+ "Skipping prefetch, the block is already cached.", size, cacheKey);
blockCount++;
dataBlockCount++;
+ // We need to reset this here, because we don't know the size of next block, since
+ // we never recovered the current block.
+ onDiskSizeOfNextBlock = -1;
continue;
} else {
LOG.debug("Found block for cache key {}, but couldn't get its size. "
@@ -150,8 +153,8 @@ public class HFilePreadReader extends HFileReaderImpl {
}
} catch (IOException e) {
// IOExceptions are probably due to region closes (relocation, etc.)
- if (LOG.isTraceEnabled()) {
- LOG.trace("Prefetch " + getPathOffsetEndStr(path, offset, end), e);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Prefetch " + getPathOffsetEndStr(path, offset, end), e);
}
} catch (Throwable e) {
// Other exceptions are interesting
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestPrefetchWithBucketCache.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestPrefetchWithBucketCache.java
index 6fdb56bfc6c..a1ad1c56e74 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestPrefetchWithBucketCache.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestPrefetchWithBucketCache.java
@@ -331,9 +331,14 @@ public class TestPrefetchWithBucketCache {
}
return true;
});
- // With the wait time configuration, prefetch should trigger no evictions once it reaches
- // cache capacity
- assertNotEquals(0, bc.getStats().getEvictedCount());
+ if (bc.getStats().getFailedInserts() == 0) {
+ // With no wait time configuration, prefetch should trigger evictions once it reaches
+ // cache capacity
+ assertNotEquals(0, bc.getStats().getEvictedCount());
+ } else {
+ LOG.info("We had {} cache insert failures, which may cause cache usage "
+ + "to never reach capacity.", bc.getStats().getFailedInserts());
+ }
}
@Test