eolivelli closed pull request #1651: Avoid releasing sent buffer to early in 
BookieClient mock 
URL: https://github.com/apache/bookkeeper/pull/1651
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/MockBookKeeperTestCase.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/MockBookKeeperTestCase.java
index 6e1557a1a8..20a8bb87d5 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/MockBookKeeperTestCase.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/MockBookKeeperTestCase.java
@@ -511,6 +511,7 @@ protected void setupBookieClientAddEntry() {
             boolean isRecoveryAdd =
                 ((short) options & BookieProtocol.FLAG_RECOVERY_ADD) == 
BookieProtocol.FLAG_RECOVERY_ADD;
 
+            toSend.retain();
             executor.executeOrdered(ledgerId, () -> {
                 byte[] entry;
                 try {
@@ -518,6 +519,7 @@ protected void setupBookieClientAddEntry() {
                 } catch (BKDigestMatchException e) {
                     callback.writeComplete(Code.DigestMatchException,
                             ledgerId, entryId, bookieSocketAddress, ctx);
+                    toSend.release();
                     return;
                 }
                 boolean fenced = fencedLedgers.contains(ledgerId);
@@ -528,6 +530,7 @@ protected void setupBookieClientAddEntry() {
                     if (failedBookies.contains(bookieSocketAddress)) {
                         callback.writeComplete(NoBookieAvailableException,
                                 ledgerId, entryId, bookieSocketAddress, ctx);
+                        toSend.release();
                         return;
                     }
                     if (getMockLedgerContentsInBookie(ledgerId, 
bookieSocketAddress).isEmpty()) {
@@ -538,6 +541,7 @@ protected void setupBookieClientAddEntry() {
                     callback.writeComplete(BKException.Code.OK,
                             ledgerId, entryId, bookieSocketAddress, ctx);
                 }
+                toSend.release();
             });
 
             return null;


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to