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 99bcf09 Fix concurrent v2 reads on the same ledger/entry
99bcf09 is described below
commit 99bcf09f6d5bbcef2f4c5228cd70e023c2348b03
Author: Matteo Merli <[email protected]>
AuthorDate: Thu Oct 19 01:43:31 2017 +0200
Fix concurrent v2 reads on the same ledger/entry
Original fix from by merlimat in the yahoo-4.3 branch
Author: Matteo Merli <[email protected]>
Reviewers: Enrico Olivelli <[email protected]>, Sijie Guo
<[email protected]>
This closes #645 from ivankelly/con-read-v2-fix
---
.../org/apache/bookkeeper/proto/PerChannelBookieClient.java | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
index dcc58f2..59510f5 100644
---
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
+++
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
@@ -726,9 +726,16 @@ public class PerChannelBookieClient extends
ChannelInboundHandlerAdapter {
.build();
}
- completionObjects.put(completionKey,
- new ReadCompletion(completionKey, cb,
- ctx, ledgerId, entryId));
+ CompletionValue existingValue = completionObjects.putIfAbsent(
+ completionKey, new ReadCompletion(completionKey, cb,
+ ctx, ledgerId, entryId));
+ if (existingValue != null) {
+ // There's a pending read request on same ledger/entry. This is
not supported in V2 protocol
+ LOG.warn("Failing concurrent request to read at ledger: {} entry:
{}", ledgerId, entryId);
+
cb.readEntryComplete(BKException.Code.UnexpectedConditionException, ledgerId,
entryId, null, ctx);
+ return;
+ }
+
writeAndFlush(channel, completionKey, request);
}
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].