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 07:22:38 UTC

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

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


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

Review Comment:
   this method use for?



##########
confignode/src/main/java/org/apache/iotdb/confignode/persistence/executor/ConfigRequestExecutor.java:
##########
@@ -56,6 +67,8 @@ public class ConfigRequestExecutor {
 
   private final AuthorInfo authorInfo;
 
+  private static final Logger LOGGER = LoggerFactory.getLogger(ConfigRequestExecutor.class);

Review Comment:
   generate, Logger add first line in class



##########
confignode/src/main/java/org/apache/iotdb/confignode/persistence/ClusterSchemaInfo.java:
##########
@@ -332,12 +342,59 @@ public List<TConsensusGroupId> getRegionGroupIds(String storageGroup, TConsensus
     return result;
   }
 
-  public void serialize(ByteBuffer buffer) {
-    // TODO: Serialize ClusterSchemaInfo
+  @Override
+  public boolean takeSnapshot(File snapshotDir) throws IOException {
+
+    File snapshotFile = new File(snapshotDir, snapshotFileName);
+    if (snapshotFile.exists() && snapshotFile.isFile()) {
+      LOGGER.error(
+          "Failed to take snapshot, because snapshot file [{}] is already exist.",
+          snapshotFile.getAbsolutePath());
+      return false;
+    }
+
+    File tmpFile = new File(snapshotFile.getAbsolutePath() + "-" + UUID.randomUUID());
+    ByteBuffer buffer = ByteBuffer.allocate(bufferSize);
+
+    storageGroupReadWriteLock.readLock().lock();

Review Comment:
   is this write lock ?    if data wirte now, we need lock.



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