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_r360630620
##########
File path:
zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/SkippedRequestQueue.java
##########
@@ -0,0 +1,78 @@
+package org.apache.zookeeper.server.quorum;
+
+import org.apache.zookeeper.server.ExitCode;
+import org.apache.zookeeper.server.Request;
+import org.apache.zookeeper.server.ServerMetrics;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.atomic.AtomicLong;
+
+public class SkippedRequestQueue {
+ private static final Logger LOG =
LoggerFactory.getLogger(SkippedRequestQueue.class);
+
+ private final AtomicLong lastCommitted = new AtomicLong(-1);
+ private final LinkedBlockingQueue<Request> waitingRequests = new
LinkedBlockingQueue<>();
+
+ /**
+ * Setter method for lastCommitted zxid
+ */
+ public void setLastCommitted(long zxid) {
+ lastCommitted.set(zxid);
Review comment:
potential race condition here with `setLastCommittedAndGet`.
----------------------------------------------------------------
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