liyuheng55555 commented on code in PR #12656:
URL: https://github.com/apache/iotdb/pull/12656#discussion_r1627053352


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClient.java:
##########
@@ -1116,4 +1129,37 @@ public boolean validateObject(
           .orElse(false);
     }
   }
+
+  private class Cursor {
+    private int value;
+    private boolean locked = false;
+
+    public Cursor(int value) {
+      this.value = value;
+    }
+
+    public int get() {
+      return value;
+    }
+
+    public void set(int value) {
+      if (!locked) {
+        this.value = value;
+      } else {
+        logger.warn(
+            "ConfigNodeClient cursor will keep {} and won't change to {}, 
because it has been locked.",
+            configNodeEndPoints.get(this.value),
+            configNodeEndPoints.get(value));
+      }
+    }
+
+    public void setAndLock(int value) {
+      set(value);
+      locked = true;
+    }
+
+    public void unlock() {
+      locked = false;
+    }

Review Comment:
   Seems not necessary, because ConfigNodeClient can find leader by it self



-- 
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: reviews-unsubscr...@iotdb.apache.org

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

Reply via email to