You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2021/03/05 08:10:39 UTC

[GitHub] [iotdb] LebronAl commented on a change in pull request #2766: [IOTDB-1118] [Distributed] Limit query log lag in mid consistency level

LebronAl commented on a change in pull request #2766:
URL: https://github.com/apache/iotdb/pull/2766#discussion_r588075978



##########
File path: cluster/src/main/java/org/apache/iotdb/cluster/config/ClusterConfig.java
##########
@@ -147,16 +147,15 @@
    */
   private boolean waitForSlowNode = true;
 
+  /** when consistency level set to mid, query failed if the log lag exceeds maxReadLogLag. */

Review comment:
       same as above

##########
File path: cluster/src/assembly/resources/conf/iotdb-cluster.properties
##########
@@ -153,4 +153,8 @@ enable_use_persist_log_on_disk_to_catch_up=true
 
 # The number of logs read on the disk at one time, which is mainly used to control the memory usage.
 # This value multiplied by the log size is about the amount of memory used to read logs from the disk at one time.
-max_number_of_logs_per_fetch_on_disk=1000
\ No newline at end of file
+max_number_of_logs_per_fetch_on_disk=1000
+
+# When consistency level set to mid, query failed if the log lag exceeds max_read_log_lag

Review comment:
       looks like syntax problems? maybe `When consistency level is set to mid, query will fail if the log lag exceeds max_read_log_lag`?

##########
File path: cluster/src/main/java/org/apache/iotdb/cluster/server/member/RaftMember.java
##########
@@ -731,28 +730,70 @@ public TSStatus executeNonQueryPlan(ExecutNonQueryReq request)
   public void syncLeaderWithConsistencyCheck(boolean isWriteRequest)
       throws CheckConsistencyException {
     if (isWriteRequest) {
-      if (!syncLeader()) {
-        throw CheckConsistencyException.CHECK_STRONG_CONSISTENCY_EXCEPTION;
-      }
+      syncLeader(new StrongCheckConsistency());
     } else {
-      switch (ClusterDescriptor.getInstance().getConfig().getConsistencyLevel()) {
+      switch (config.getConsistencyLevel()) {
         case STRONG_CONSISTENCY:
-          if (!syncLeader()) {
-            throw CheckConsistencyException.CHECK_STRONG_CONSISTENCY_EXCEPTION;
-          }
+          syncLeader(new StrongCheckConsistency());
           return;
         case MID_CONSISTENCY:
-          // do not care success or not
-          syncLeader();
+          // if leaderCommitId bigger than localAppliedId a value,
+          // will throw CHECK_MID_CONSISTENCY_EXCEPTION
+          syncLeader(
+              new CheckConsistency() {

Review comment:
       +1 for jt2594838 




----------------------------------------------------------------
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:
users@infra.apache.org