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/09/27 17:46:11 UTC
[bookkeeper] branch master updated: [LOGGING] PendingReadOp should
log the error code when failing requests
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 33e9d27 [LOGGING] PendingReadOp should log the error code when failing requests
33e9d27 is described below
commit 33e9d27beb857834e4dc7b5ca3b69bff9d89bb9f
Author: Sijie Guo <gu...@gmail.com>
AuthorDate: Thu Sep 27 10:46:05 2018 -0700
[LOGGING] PendingReadOp should log the error code when failing requests
Descriptions of the changes in this PR:
*Motivation*
Currently when a request is failed, bookkeeper client logs the error message. However the log
message doesn't include error code. It makes debugging hard.
*Changes*
Improve the log message to include error code
Author:
Reviewers: Andrey Yegorov <None>, Enrico Olivelli <eo...@gmail.com>
This closes #1709 from sijie/improve_error_logging
---
.../src/main/java/org/apache/bookkeeper/client/PendingReadOp.java | 6 ++++--
1 file changed, 4 insertions(+), 2 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 4ee9c92..a66d889 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
@@ -614,17 +614,19 @@ class PendingReadOp implements ReadEntryCallback, SafeRunnable {
long latencyNanos = MathUtils.elapsedNanos(requestTimeNanos);
if (code != BKException.Code.OK) {
long firstUnread = LedgerHandle.INVALID_ENTRY_ID;
+ Integer firstRc = null;
for (LedgerEntryRequest req : seq) {
if (!req.isComplete()) {
firstUnread = req.eId;
+ firstRc = req.rc;
break;
}
}
LOG.error(
"Read of ledger entry failed: L{} E{}-E{}, Sent to {}, "
- + "Heard from {} : bitset = {}. First unread entry is {}",
+ + "Heard from {} : bitset = {}, Error = '{}'. First unread entry is ({}, rc = {})",
lh.getId(), startEntryId, endEntryId, sentToHosts, heardFromHosts, heardFromHostsBitSet,
- firstUnread);
+ BKException.getMessage(code), firstUnread, firstRc);
clientCtx.getClientStats().getReadOpLogger().registerFailedEvent(latencyNanos, TimeUnit.NANOSECONDS);
// release the entries
seq.forEach(LedgerEntryRequest::close);