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/10/31 02:48:44 UTC

[GitHub] [iotdb] Cpaulyz commented on a diff in pull request #7709: [IOTDB-4719] SchemaFile adaptation for cluster delete timeseries

Cpaulyz commented on code in PR #7709:
URL: https://github.com/apache/iotdb/pull/7709#discussion_r1008990271


##########
server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionSchemaFileImpl.java:
##########
@@ -759,23 +759,102 @@ public synchronized Pair<Integer, Set<String>> deleteTimeseries(
 
   @Override
   public int constructSchemaBlackList(PathPatternTree patternTree) throws MetadataException {
-    throw new UnsupportedOperationException();
+    int preDeletedNum = 0;
+    for (PartialPath pathPattern : patternTree.getAllPathPatterns()) {
+      for (IMeasurementMNode measurementMNode : mtree.getMatchedMeasurementMNode(pathPattern)) {
+        // Given pathPatterns may match one timeseries multi times, which may results in the
+        // preDeletedNum larger than the actual num of timeseries. It doesn't matter since the main
+        // purpose is to check whether there's timeseries to be deleted.
+        try {
+          preDeletedNum++;
+          measurementMNode.setPreDeleted(true);
+          mtree.updateMNode(measurementMNode);
+          if (!isRecovering) {
+            logWriter.write(
+                SchemaRegionPlanFactory.getPreDeleteTimeSeriesPlan(
+                    measurementMNode.getPartialPath()));
+          }
+        } catch (IOException e) {
+          throw new MetadataException(e);
+        } finally {
+          mtree.unPinMNode(measurementMNode);

Review Comment:
   done



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