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 07:50:27 UTC

[GitHub] [iotdb] neuyilan commented on a diff in pull request #7776: [IOTDB-4676][IOTDB-4677] Support sync DeleteTimeseries and sync Delete Data

neuyilan commented on code in PR #7776:
URL: https://github.com/apache/iotdb/pull/7776#discussion_r1009115079


##########
server/src/main/java/org/apache/iotdb/db/sync/sender/manager/LocalSyncManager.java:
##########
@@ -46,8 +54,31 @@ public LocalSyncManager(DataRegion dataRegion, Pipe pipe) {
 
   /** tsfile */
   @Override
-  public void syncRealTimeDeletion(Deletion deletion) {
-    syncPipe.collectRealTimeDeletion(deletion, dataRegion.getStorageGroupName(), dataRegionId);
+  public void syncRealTimeDeletion(
+      Deletion deletion,
+      List<TsFileResource> unsealedResources,
+      List<TsFileResource> sealedResources) {
+    Set<String> devices = new HashSet<>();
+    unsealedResources.forEach(o -> devices.addAll(o.getDevices()));
+    sealedResources.forEach(o -> devices.addAll(o.getDevices()));
+
+    for (String device : devices) {
+      try {
+        PartialPath path =
+            new PartialPath(device).concatNode(IoTDBConstant.MULTI_LEVEL_PATH_WILDCARD);
+        if (deletion.getPath().overlapWith(path)) {
+          Deletion splitDeletion =
+              new Deletion(deletion.getPath(), 0, deletion.getStartTime(), deletion.getEndTime());
+          syncPipe.collectRealTimeDeletion(
+              splitDeletion, dataRegion.getStorageGroupName(), dataRegionId);
+        }
+      } catch (IllegalPathException e) {
+        logger.error(
+            String.format(
+                "Parse device path %s to partial path error when splitting deletion.", device),
+            e);

Review Comment:
   These codes may not  really be understandable, 
   
   If the codes in 69 is true for `device1`, then the deletion will be added to the sync pipe.
   
   In the next loop, for `device2`, if the codes in 69 is still `TRUE`, then the deletion will be added to the sync pipe **again**. is this expected?



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