This is an automated email from the ASF dual-hosted git repository.
shoothzj pushed a commit to branch branch-4.15
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/branch-4.15 by this push:
new 73c0cbffc3 Add missed call to onReadRequestFinish() when read request
rejected (#3482)
73c0cbffc3 is described below
commit 73c0cbffc3b72d94c95c396350eb1000fa21c35c
Author: Michael Marshall <[email protected]>
AuthorDate: Sun Sep 11 23:57:08 2022 -0700
Add missed call to onReadRequestFinish() when read request rejected (#3482)
Fixes: https://github.com/apache/bookkeeper/issues/2945
### Motivation
When a read request is rejected due to the limit on the number of reads
that can be enqueued, we need to decrement the metric for
`bookkeeper_server_READ_ENTRY_IN_PROGRESS` and release the `readsSemaphore`, if
it is not null.
### Changes
* Call `onReadRequestFinish()` for failures in the V2 and V3 request
processing logic.
### Observation
It looks like the V2 responses for this kind of failure are not throttled,
even when `throttleReadResponses` is true. We could call
`read.sendReadReqResponse(` to enable this throttling. I didn't change it here
because there might be a reason we're not throttling these small responses.
---
.../main/java/org/apache/bookkeeper/proto/BookieRequestProcessor.java | 2 ++
1 file changed, 2 insertions(+)
diff --git
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieRequestProcessor.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieRequestProcessor.java
index 886556ff6d..cb72b70681 100644
---
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieRequestProcessor.java
+++
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieRequestProcessor.java
@@ -543,6 +543,7 @@ public class BookieRequestProcessor implements
RequestProcessor {
.setReadResponse(readResponse);
BookkeeperProtocol.Response resp = response.build();
read.sendResponse(readResponse.getStatus(), resp,
requestStats.getReadRequestStats());
+ onReadRequestFinish();
}
}
}
@@ -680,6 +681,7 @@ public class BookieRequestProcessor implements
RequestProcessor {
BookieProtocol.ETOOMANYREQUESTS,
ResponseBuilder.buildErrorResponse(BookieProtocol.ETOOMANYREQUESTS, r),
requestStats.getReadRequestStats());
+ onReadRequestFinish();
}
}
}