horizonzy commented on code in PR #3846:
URL: https://github.com/apache/bookkeeper/pull/3846#discussion_r1147148509
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieRequestProcessor.java:
##########
@@ -205,21 +206,21 @@ public BookieRequestProcessor(ServerConfiguration
serverCfg, Bookie bookie, Stat
readsSemaphore = maxReads > 0 ? new Semaphore(maxReads, true) : null;
}
- protected void onAddRequestStart(Channel channel) {
+ protected void onAddRequestStart(Channel channel, int permits) {
if (addsSemaphore != null) {
- if (!addsSemaphore.tryAcquire()) {
+ if (!addsSemaphore.tryAcquire(permits)) {
final long throttlingStartTimeNanos = MathUtils.nowInNano();
channel.config().setAutoRead(false);
LOG.info("Too many add requests in progress, disabling
autoread on channel {}", channel);
requestStats.blockAddRequest();
- addsSemaphore.acquireUninterruptibly();
+ addsSemaphore.acquireUninterruptibly(permits);
Review Comment:
+1
--
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]