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 04:03:08 UTC

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

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



##########
File path: cluster/src/assembly/resources/conf/iotdb-cluster.properties
##########
@@ -148,4 +148,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
+# This default value is 1000
+max_read_log_lag=1000

Review comment:
       Yes, at least we can supplement that one log corresponds to one client operation.

##########
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:
       But I do not think it is necessary to `new` each time the method is called, as they are not changed throughout the process. Maybe you can make them static members of a class. 




----------------------------------------------------------------
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