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/03/19 17:57:49 UTC

[bookkeeper] branch master updated: Fix logging issue on PendingReadOp

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 6667955  Fix logging issue on PendingReadOp
6667955 is described below

commit 6667955cd1fd973f9880831b4b59f525663d5ff8
Author: Sijie Guo <si...@apache.org>
AuthorDate: Mon Mar 19 10:57:42 2018 -0700

    Fix logging issue on PendingReadOp
    
    Descriptions of the changes in this PR:
    
    `EntryImpl` is recycled after callback is submitted for a given read op. However the object might be referenced after it is recycled, since read callback can come back after the read op is error-out.
    
    This doesn't affect any operation or correctness. However it might introduce some confused logging.
    
    This also got exposed by #1268
    
    Author: Sijie Guo <si...@apache.org>
    
    Reviewers: Enrico Olivelli <eo...@gmail.com>, Matteo Merli <mm...@apache.org>
    
    This closes #1276 from sijie/fix_recycling_entries
---
 .../java/org/apache/bookkeeper/client/PendingReadOp.java     | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/PendingReadOp.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/PendingReadOp.java
index d596eee..484e9c7 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/PendingReadOp.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/PendingReadOp.java
@@ -135,7 +135,7 @@ class PendingReadOp implements ReadEntryCallback, SafeRunnable {
         boolean complete(int bookieIndex, BookieSocketAddress host, final ByteBuf buffer) {
             ByteBuf content;
             try {
-                content = lh.macManager.verifyDigestAndReturnData(entryImpl.getEntryId(), buffer);
+                content = lh.macManager.verifyDigestAndReturnData(eId, buffer);
             } catch (BKDigestMatchException e) {
                 readOpDmCounter.inc();
                 logErrorAndReattemptRead(bookieIndex, host, "Mac mismatch", BKException.Code.DigestMatchException);
@@ -205,12 +205,12 @@ class PendingReadOp implements ReadEntryCallback, SafeRunnable {
                 ++numBookiesMissingEntry;
                 if (LOG.isDebugEnabled()) {
                     LOG.debug("No such entry found on bookie.  L{} E{} bookie: {}",
-                            lh.ledgerId, entryImpl.getEntryId(), host);
+                            lh.ledgerId, eId, host);
                 }
             } else {
                 if (LOG.isDebugEnabled()) {
                     LOG.debug(errMsg + " while reading L{} E{} from bookie: {}",
-                            lh.ledgerId, entryImpl.getEntryId(), host);
+                            lh.ledgerId, eId, host);
                 }
             }
         }
@@ -245,7 +245,7 @@ class PendingReadOp implements ReadEntryCallback, SafeRunnable {
 
         @Override
         public String toString() {
-            return String.format("L%d-E%d", entryImpl.getLedgerId(), entryImpl.getEntryId());
+            return String.format("L%d-E%d", lh.getId(), eId);
         }
 
         /**
@@ -569,7 +569,7 @@ class PendingReadOp implements ReadEntryCallback, SafeRunnable {
         }
 
         int flags = isRecoveryRead ? BookieProtocol.FLAG_HIGH_PRIORITY : BookieProtocol.FLAG_NONE;
-        lh.bk.getBookieClient().readEntry(to, lh.ledgerId, entry.entryImpl.getEntryId(),
+        lh.bk.getBookieClient().readEntry(to, lh.ledgerId, entry.eId,
                                           this, new ReadContext(bookieIndex, to, entry),
                                           flags);
     }
@@ -624,7 +624,7 @@ class PendingReadOp implements ReadEntryCallback, SafeRunnable {
             long firstUnread = LedgerHandle.INVALID_ENTRY_ID;
             for (LedgerEntryRequest req : seq) {
                 if (!req.isComplete()) {
-                    firstUnread = req.entryImpl.getEntryId();
+                    firstUnread = req.eId;
                     break;
                 }
             }

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