You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2022/09/02 11:58:15 UTC

[GitHub] [zookeeper] eolivelli commented on a diff in pull request #1137: ZOOKEEPER-3600:[WIP]support the complete Linearizability Read

eolivelli commented on code in PR #1137:
URL: https://github.com/apache/zookeeper/pull/1137#discussion_r961597059


##########
zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeper.java:
##########
@@ -2026,6 +2031,87 @@ public void getData(final String path, Watcher watcher, DataCallback cb, Object
         cnxn.queuePacket(h, new ReplyHeader(), request, response, cb, clientPath, serverPath, ctx, wcb);
     }
 
+    /**
+     * TODO
+     * @param path
+     * @param watcher
+     * @param readMode
+     * @return
+     * @throws KeeperException
+     * @throws InterruptedException
+     * @since
+     */
+    public CompletableFuture<ZNode> getData(ReadConsistencyMode readMode, final String path, Watcher watcher) throws KeeperException, InterruptedException {

Review Comment:
   CompletableFuture is tricky, because there is no control over the thread that execute any callback/listener
   
   it is appealing but I won't use it here, all the API is based on callbacks that are guaranteed to be executed in the ZK thread 



##########
zookeeper-server/src/main/java/org/apache/zookeeper/client/ReadConsistencyMode.java:
##########
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zookeeper.client;
+
+import org.apache.yetus.audience.InterfaceAudience;
+
+/**
+ * TODO
+ * @since 3.7.0
+ */
+@InterfaceAudience.Public
+public enum ReadConsistencyMode {
+    SEQUENTIAL_READ("Sequential Read"),
+    ORDERED_SEQUENTIAL_READ("Ordered Sequential Read"),
+    LINEARIZABLE_READ("Linearizable Read"),
+    LEASE_READ("Lease Read"),
+    DUMMY_READ("Dummy Read Used For Testing");

Review Comment:
   we should remove this DUMMY_READ mode



##########
zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/CommitProcessor.java:
##########
@@ -249,14 +253,18 @@ public void run() {
                        && (maxReadBatchSize < 0 || readsProcessed <= maxReadBatchSize)
                        && (request = queuedRequests.poll()) != null) {
                     requestsToProcess--;
+                    //System.out.println("fuck__CommitProcessor_needCommit(request):" + needCommit(request) + ",pendingRequests.containsKey(request.sessionId):"+

Review Comment:
   please do not commit this lines or put them in PRs
   they are sent over the mailing lists and tracked in the archives



##########
zookeeper-server/src/main/java/org/apache/zookeeper/ZooDefs.java:
##########
@@ -55,6 +55,9 @@ public interface OpCode {
 
         int sync = 9;
 
+        // sync
+        int syncedRead = 10;

Review Comment:
   why using 10 ? isn't it better to use 109 ?



-- 
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: notifications-unsubscribe@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org