hanm commented on a change in pull request #1172: ZOOKEEPER-3594: Ability to 
skip proposing requests with error transactions
URL: https://github.com/apache/zookeeper/pull/1172#discussion_r360624319
 
 

 ##########
 File path: 
zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/LearnerHandler.java
 ##########
 @@ -1159,4 +1178,43 @@ public void setFirstPacket(boolean value) {
         needOpPacket = value;
     }
 
+    private final SkippedRequestQueue skippedRequestQueue = new 
SkippedRequestQueue();
+
+    /**
+     * This method must be called from the RP chain thread
+     * right after PrepRequestProcessor. Once it's known that
+     * the request is invalid we can skip sending PROPOSE and go directly to
+     * COMMIT but we need to wait to do that in order with the other requests.
+     *
+     * The request will be immediately sent back to the learner if there is no 
pending commits
+     * otherwise the request will be put inside the handler's queue to wait 
for pending commit
+     * to complete before is sent so we make sure we send all requests in 
order.
+     */
+    public void skipProposing(Request request) {
+        List<Request> requests = skippedRequestQueue.addAndGet(request);
+        processSkippedRequests(requests);
+    }
+
+    /**
+     * Learner specific commitProcessing logic
+     */
+    public void processCommit(long zxid) {
 
 Review comment:
   I don't see this is used elsewhere. Should this be `private` instead?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to