You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by iv...@apache.org on 2017/10/18 20:40:12 UTC
[bookkeeper] branch master updated: Fixed ref counting release on
read errors
This is an automated email from the ASF dual-hosted git repository.
ivank 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 fd477f6 Fixed ref counting release on read errors
fd477f6 is described below
commit fd477f6310a512e76fa3284b100d6e11411939b8
Author: Matteo Merli <mm...@yahoo-inc.com>
AuthorDate: Wed Oct 18 22:40:04 2017 +0200
Fixed ref counting release on read errors
Original change by merlimat in yahoo-3.4 branch
Author: Matteo Merli <mm...@yahoo-inc.com>
Reviewers: Sijie Guo <si...@apache.org>
This closes #644 from ivankelly/fix-ref-read
---
.../src/main/java/org/apache/bookkeeper/proto/BookieProtocol.java | 2 +-
.../src/main/java/org/apache/bookkeeper/proto/ReadEntryProcessor.java | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieProtocol.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieProtocol.java
index 99c33fb..6fc91e5 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieProtocol.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieProtocol.java
@@ -342,7 +342,7 @@ public interface BookieProtocol {
}
boolean hasData() {
- return data != null;
+ return data.readableBytes() > 0;
}
ByteBuf getData() {
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/ReadEntryProcessor.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/ReadEntryProcessor.java
index 9cc7d17..f65455c 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/ReadEntryProcessor.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/ReadEntryProcessor.java
@@ -83,6 +83,7 @@ class ReadEntryProcessor extends PacketProcessorBase {
if (null == fenced || !fenced) {
// if failed to fence, fail the read request to make it retry.
errorCode = BookieProtocol.EIO;
+ data.release();
data = null;
} else {
errorCode = BookieProtocol.EOK;
@@ -90,14 +91,17 @@ class ReadEntryProcessor extends PacketProcessorBase {
} catch (InterruptedException ie) {
LOG.error("Interrupting fence read entry " + read, ie);
errorCode = BookieProtocol.EIO;
+ data.release();
data = null;
} catch (ExecutionException ee) {
LOG.error("Failed to fence read entry " + read, ee);
errorCode = BookieProtocol.EIO;
+ data.release();
data = null;
} catch (TimeoutException te) {
LOG.error("Timeout to fence read entry " + read, te);
errorCode = BookieProtocol.EIO;
+ data.release();
data = null;
}
} else {
--
To stop receiving notification emails like this one, please contact
['"commits@bookkeeper.apache.org" <co...@bookkeeper.apache.org>'].