eolivelli commented on a change in pull request #3110:
URL: https://github.com/apache/bookkeeper/pull/3110#discussion_r828831928
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/PendingReadOp.java
##########
@@ -580,18 +590,23 @@ void sendReadTo(int bookieIndex, BookieId to,
LedgerEntryRequest entry) throws I
@Override
public void readEntryComplete(int rc, long ledgerId, final long entryId,
final ByteBuf buffer, Object ctx) {
+
final ReadContext rctx = (ReadContext) ctx;
final LedgerEntryRequest entry = rctx.entry;
if (rc != BKException.Code.OK) {
- entry.logErrorAndReattemptRead(rctx.bookieIndex, rctx.to, "Error:
" + BKException.getMessage(rc), rc);
+ // if entry complete = true, don't need logErrorAndReattemptRead
+ if (!entry.complete.get()) {
Review comment:
we should add a test covering this change: calling readEntryComplete
with a non-OK error code twice
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/PendingReadOp.java
##########
@@ -580,18 +590,23 @@ void sendReadTo(int bookieIndex, BookieId to,
LedgerEntryRequest entry) throws I
@Override
public void readEntryComplete(int rc, long ledgerId, final long entryId,
final ByteBuf buffer, Object ctx) {
+
final ReadContext rctx = (ReadContext) ctx;
final LedgerEntryRequest entry = rctx.entry;
if (rc != BKException.Code.OK) {
- entry.logErrorAndReattemptRead(rctx.bookieIndex, rctx.to, "Error:
" + BKException.getMessage(rc), rc);
+ // if entry complete = true, don't need logErrorAndReattemptRead
+ if (!entry.complete.get()) {
+ entry.logErrorAndReattemptRead(rctx.bookieIndex, rctx.to,
"Error: " + BKException.getMessage(rc), rc);
+ }
return;
}
heardFromHosts.add(rctx.to);
heardFromHostsBitSet.set(rctx.bookieIndex, true);
buffer.retain();
+ // if entry has completed don't handle twice
Review comment:
do we have a test for this case ?
can you add this case to your new tests please ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]