You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by si...@apache.org on 2018/01/30 20:02:55 UTC

[bookkeeper] branch master updated: Fixing validation in BookieShell.scanEntryLogForSpecificEntry

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

sijie 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 47854b9  Fixing validation in BookieShell.scanEntryLogForSpecificEntry
47854b9 is described below

commit 47854b9234f612b2080decd4720cf3d1772f8455
Author: cguttapalem <cg...@salesforce.com>
AuthorDate: Tue Jan 30 12:02:49 2018 -0800

    Fixing validation in BookieShell.scanEntryLogForSpecificEntry
    
    Descriptions of the changes in this PR:
    
    https://github.com/apache/bookkeeper/commit/086537beda9427c057a286ad6c4614659da6ed7f
    has messed up conditional checks in BookieShell.scanEntryLogForSpecificEntry.
    Reverting those changes.
    
    Author: cguttapalem <cg...@salesforce.com>
    
    Reviewers: Sijie Guo <si...@apache.org>
    
    This closes #1076 from reddycharan/fixScanEntryLogForSpecificEntry
---
 .../src/main/java/org/apache/bookkeeper/bookie/BookieShell.java  | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java
index 51aa79f..44fcaa9 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java
@@ -3157,15 +3157,16 @@ public class BookieShell implements Tool {
         final MutableBoolean entryFound = new MutableBoolean(false);
         scanEntryLog(logId, new EntryLogScanner() {
             @Override
-            public boolean accept(long ledgerId) {
-                return (((!entryFound.booleanValue()) || (entryId == -1)));
+            public boolean accept(long candidateLedgerId) {
+                return ((candidateLedgerId == ledgerId) && ((!entryFound.booleanValue()) || (entryId == -1)));
             }
 
             @Override
-            public void process(long ledgerId, long startPos, ByteBuf entry) {
+            public void process(long candidateLedgerId, long startPos, ByteBuf entry) {
                 long entrysLedgerId = entry.getLong(entry.readerIndex());
                 long entrysEntryId = entry.getLong(entry.readerIndex() + 8);
-                if ((ledgerId == entrysLedgerId) && ((entrysEntryId == entryId)) || (entryId == -1)) {
+                if ((candidateLedgerId == entrysLedgerId) && (candidateLedgerId == ledgerId)
+                        && ((entrysEntryId == entryId) || (entryId == -1))) {
                     entryFound.setValue(true);
                     formatEntry(startPos, entry, printMsg);
                 }

-- 
To stop receiving notification emails like this one, please contact
sijie@apache.org.