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

wchevreuil pushed a commit to branch branch-3
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-3 by this push:
     new 1c8c09a669e [ADDENDUM] HBASE-29288 Avoid adding new blocks during 
prefetch if usage is greater than accept factor (#6965) (#6990)
1c8c09a669e is described below

commit 1c8c09a669efd25b12a978ec5f98510c0e2392f0
Author: Wellington Ramos Chevreuil <[email protected]>
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 <[email protected]>
---
 .../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

Reply via email to