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

eolivelli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 45871dc  Fix batch read data in cache does not take effect
45871dc is described below

commit 45871dccbb72a5aee30f7bbfaacfa0d6c2c202a5
Author: liudezhi <[email protected]>
AuthorDate: Mon Apr 13 15:26:07 2020 +0800

    Fix batch read data in cache does not take effect
    
    Descriptions of the changes in this PR:
    
    
    
    ### Motivation
    
    Fix batch read data in cache does not take effect
    
    ### Changes
    
    (Describe: what changes you have made)
    
    Master Issue: #2230
    Fixes: #2230
    
    
    
    
    Reviewers: Jia Zhai <[email protected]>, Enrico Olivelli 
<[email protected]>, Sijie Guo <None>
    
    This closes #2231 from liudezhi2098/issue-branch-xxx
---
 .../bookkeeper/bookie/storage/ldb/SingleDirectoryDbLedgerStorage.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/SingleDirectoryDbLedgerStorage.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/SingleDirectoryDbLedgerStorage.java
index e975f16..a6ae8c5 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/SingleDirectoryDbLedgerStorage.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/SingleDirectoryDbLedgerStorage.java
@@ -466,7 +466,7 @@ public class SingleDirectoryDbLedgerStorage implements 
CompactableLedgerStorage
             long size = 0;
 
             while (count < readAheadCacheBatchSize && currentEntryLogId == 
firstEntryLogId) {
-                ByteBuf entry = entryLogger.internalReadEntry(orginalLedgerId, 
-1, currentEntryLocation,
+                ByteBuf entry = entryLogger.internalReadEntry(orginalLedgerId, 
firstEntryId, currentEntryLocation,
                         false /* validateEntry */);
 
                 try {
@@ -482,6 +482,7 @@ public class SingleDirectoryDbLedgerStorage implements 
CompactableLedgerStorage
                     readCache.put(orginalLedgerId, currentEntryId, entry);
 
                     count++;
+                    firstEntryId++;
                     size += entry.readableBytes();
 
                     currentEntryLocation += 4 + entry.readableBytes();

Reply via email to