You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by ni...@apache.org on 2022/09/19 10:00:32 UTC

[bookkeeper] 21/22: Add missed call to onReadRequestFinish() when read request rejected (#3482)

This is an automated email from the ASF dual-hosted git repository.

nicoloboschi pushed a commit to branch ds-4.14
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git

commit 1cb10ce578336036203d92109ff57e69801063e8
Author: Michael Marshall <mm...@apache.org>
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.
    
    (cherry picked from commit 6fa13ecdfca01d4d65d49c489484acc5755e616e)
---
 .../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 2223274882..d34ce3c9da 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
@@ -540,6 +540,7 @@ public class BookieRequestProcessor implements RequestProcessor {
                     .setReadResponse(readResponse);
                 BookkeeperProtocol.Response resp = response.build();
                 read.sendResponse(readResponse.getStatus(), resp, requestStats.getReadRequestStats());
+                onReadRequestFinish();
             }
         }
     }
@@ -676,6 +677,7 @@ public class BookieRequestProcessor implements RequestProcessor {
                     BookieProtocol.ETOOMANYREQUESTS,
                     ResponseBuilder.buildErrorResponse(BookieProtocol.ETOOMANYREQUESTS, r),
                     requestStats.getReadRequestStats());
+                onReadRequestFinish();
             }
         }
     }