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 2022/11/27 14:15:14 UTC

[GitHub] [iotdb] qiaojialin commented on a diff in pull request #8202: Ratis disk usage control

qiaojialin commented on code in PR #8202:
URL: https://github.com/apache/iotdb/pull/8202#discussion_r1032939113


##########
consensus/src/main/java/org/apache/iotdb/consensus/ratis/RatisConsensus.java:
##########
@@ -672,6 +680,42 @@ public ConsensusGenericResponse triggerSnapshot(ConsensusGroupId groupId) {
     return ConsensusGenericResponse.newBuilder().setSuccess(reply.isSuccess()).build();
   }
 
+  private void triggerSnapshotByCustomize() {
+
+    Iterable<RaftGroupId> groupIds = server.getGroupIds();
+
+    for (RaftGroupId raftGroupId : groupIds) {
+      File currentDir = null;
+
+      try {
+        currentDir =
+            server.getDivision(raftGroupId).getRaftStorage().getStorageDir().getCurrentDir();
+      } catch (IOException e) {
+        logger.warn("Get division failed: ", e);
+      }
+
+      final long currentDirLength =
+          org.apache.iotdb.consensus.common.Utils.getTotalFolderSize(currentDir);

Review Comment:
   If you recalculate in each call, This may time consuming



##########
thrift-confignode/src/main/thrift/confignode.thrift:
##########
@@ -89,6 +89,9 @@ struct TRatisConfig {
 
   25: required i64 firstElectionTimeoutMin
   26: required i64 firstElectionTimeoutMax
+
+  27: required i64 schemaRegionRatisLogMax
+  28: required i64 dataRegionRatisLogMax

Review Comment:
   optional



##########
consensus/src/main/java/org/apache/iotdb/consensus/common/Utils.java:
##########
@@ -74,4 +74,10 @@ public FileVisitResult postVisitDirectory(Path dir, IOException exc)
     }
     return allFiles;
   }
+
+  public static long getTotalFolderSize(File rootDir) {

Review Comment:
   refer to WAL, they calculate this in an incremented manner



##########
node-commons/src/assembly/resources/conf/iotdb-common.properties:
##########
@@ -931,6 +931,11 @@
 # schema_region_ratis_preserve_logs_num_when_purge=1000
 # data_region_ratis_preserve_logs_num_when_purge=1000
 
+# Raft Log disk size control
+# config_node_ratis_log_max_size_mb = 2048
+# schema_region_ratis_log_max_size_mb = 2048
+# data_region_ratis_log_max_size_mb = 20480

Review Comment:
   in byte



-- 
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-unsubscribe@iotdb.apache.org

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