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/05/07 06:50:54 UTC

[GitHub] [iotdb] cigarl commented on a diff in pull request #5816: [IOTDB-3098] ClusterSchemaInfo snapshot interface

cigarl commented on code in PR #5816:
URL: https://github.com/apache/iotdb/pull/5816#discussion_r867314093


##########
confignode/src/main/java/org/apache/iotdb/confignode/service/executor/ConfigRequestExecutor.java:
##########
@@ -135,4 +148,56 @@ public TSStatus executorNonQueryPlan(ConfigRequest req)
         throw new UnknownPhysicalPlanTypeException(req.getType());
     }
   }
+
+  public boolean takeSnapshot(File snapshotDir) {
+

Review Comment:
   fixed.



##########
confignode/src/main/java/org/apache/iotdb/confignode/service/executor/ConfigRequestExecutor.java:
##########
@@ -135,4 +148,56 @@ public TSStatus executorNonQueryPlan(ConfigRequest req)
         throw new UnknownPhysicalPlanTypeException(req.getType());
     }
   }
+
+  public boolean takeSnapshot(File snapshotDir) {
+
+    AtomicBoolean result = new AtomicBoolean(true);
+    getAllAttributes()
+        .parallelStream()
+        .forEach(
+            x -> {
+              boolean takeSnapshotResult = true;
+              try {
+                String fileName = x.getClass().getSimpleName();
+                File file = new File(snapshotDir, fileName);
+                takeSnapshotResult = x.takeSnapshot(file);
+              } catch (TException | IOException e) {
+                LOGGER.error(e.getMessage());
+                takeSnapshotResult = false;
+              } finally {
+                // If any snapshot fails, the whole fails
+                // So this is just going to be false
+                if (!takeSnapshotResult) {
+                  result.set(false);
+                }
+              }
+            });
+    return result.get();
+  }
+
+  public void loadSnapshot(File latestSnapshotRootDir) {
+

Review Comment:
   fixed.



##########
confignode/src/main/java/org/apache/iotdb/confignode/persistence/ClusterSchemaInfo.java:
##########
@@ -330,12 +338,42 @@ public List<TConsensusGroupId> getRegionGroupIds(String storageGroup, TConsensus
     return result;
   }
 
-  public void serialize(ByteBuffer buffer) {
-    // TODO: Serialize ClusterSchemaInfo
+  @Override
+  public boolean takeSnapshot(File snapshotFile) throws IOException {

Review Comment:
   fixed.



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