zyk990424 commented on a change in pull request #4537:
URL: https://github.com/apache/iotdb/pull/4537#discussion_r769363706



##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
##########
@@ -1021,6 +1021,18 @@ public PartialPath getBelongedStorageGroup(PartialPath 
path) throws StorageGroup
     return mtree.getDevices(pathPattern, false);
   }
 
+  /**
+   * Get all device paths matching the path pattern by prefix.
+   *
+   * @param pathPattern the pattern of the target devices.
+   * @param isPrefixMatch whether to use prefix matching
+   * @return A HashSet instance which stores devices paths matching the given 
path pattern.
+   */
+  public Set<PartialPath> getMatchedDevicesByPrex(PartialPath pathPattern, 
boolean isPrefixMatch)
+      throws MetadataException {
+    return mtree.getDevices(pathPattern, isPrefixMatch);
+  }

Review comment:
       Fix name to getMatchedDeviceByPrefix.

##########
File path: 
server/src/main/java/org/apache/iotdb/db/engine/compaction/cross/inplace/manage/CrossSpaceMergeResource.java
##########
@@ -103,12 +103,15 @@ public void clear() throws IOException {
     fileReaderCache.clear();
     fileWriterCache.clear();
     modificationCache.clear();
-    measurementSchemaMap.clear();
     chunkWriterCache.clear();
   }
 
   public IMeasurementSchema getSchema(PartialPath path) {
-    return measurementSchemaMap.get(path);
+    try {
+      return IoTDB.metaManager.getMeasurementMNode(path).getSchema();
+    } catch (MetadataException e) {
+      return null;
+    }

Review comment:
       Using methods like getSeriesSchema in MManager to get schema directly

##########
File path: 
server/src/main/java/org/apache/iotdb/db/engine/compaction/cross/inplace/task/MergeMultiChunkTask.java
##########
@@ -112,33 +115,42 @@ public MergeMultiChunkTask(
       InplaceCompactionLogger inplaceCompactionLogger,
       CrossSpaceMergeResource mergeResource,
       boolean fullMerge,
-      List<PartialPath> unmergedSeries,
+      List<PartialPath> unmergedDevice,
       int concurrentMergeSeriesNum,
       String storageGroupName) {
     this.mergeContext = context;
     this.taskName = taskName;
     this.inplaceCompactionLogger = inplaceCompactionLogger;
     this.resource = mergeResource;
     this.fullMerge = fullMerge;
-    this.unmergedSeries = unmergedSeries;
+    this.unmergedDevice = unmergedDevice;
     this.concurrentMergeSeriesNum = concurrentMergeSeriesNum;
     this.storageGroupName = storageGroupName;
   }
 
   void mergeSeries() throws IOException {
-    if (logger.isInfoEnabled()) {
-      logger.info("{} starts to merge {} series", taskName, 
unmergedSeries.size());
-    }
     long startTime = System.currentTimeMillis();
     for (TsFileResource seqFile : resource.getSeqFiles()) {
       // record the unmergeChunkStartTime for each sensor in each file
       mergeContext.getUnmergedChunkStartTimes().put(seqFile, new HashMap<>());
     }
+    mergedDeviceCnt = 0;
     // merge each series and write data into each seqFile's corresponding temp 
merge file
-    List<List<PartialPath>> devicePaths = 
MergeUtils.splitPathsByDevice(unmergedSeries);
-    for (List<PartialPath> pathList : devicePaths) {
+    for (PartialPath device : unmergedDevice) {
       // TODO: use statistics of queries to better rearrange series
-      IMergePathSelector pathSelector = new NaivePathSelector(pathList, 
concurrentMergeSeriesNum);
+      List<PartialPath> measurementPathListByDevice;
+      try {
+        measurementPathListByDevice =
+            new 
ArrayList<>(IoTDB.metaManager.getAllMeasurementByDevicePath(device));

Review comment:
       This methods, getAllMeasurementByDevicePath, returns measurementPath 
which contains schema. Maybe you could use the returned schema directly rather 
than query mmanager for second time.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to