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 2020/07/14 06:33:41 UTC

[GitHub] [incubator-iotdb] qiaojialin commented on a change in pull request #1474: prepare for wal replayed successfully after restart

qiaojialin commented on a change in pull request #1474:
URL: https://github.com/apache/incubator-iotdb/pull/1474#discussion_r454123168



##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
##########
@@ -1837,6 +1758,40 @@ public void cacheSchema(String path, MeasurementSchema schema) {
     boolean satisfy(String storageGroup);
   }
 
+  /**
+   * if the path is in local mtree, nothing needed to do (because mtree is in the memory); Otherwise
+   * cache the path to mRemoteSchemaCache
+   */
+  public void cacheMeta(String path, MeasurementMeta meta) {
+    // do nothing
+  }
+
+  public void updateLastCache(String seriesPath, TimeValuePair timeValuePair,
+                              boolean highPriorityUpdate, Long latestFlushedTime,
+                              MeasurementMNode node) {
+    if (node != null) {
+      node.updateCachedLast(timeValuePair, highPriorityUpdate, latestFlushedTime);
+    } else {
+      try {
+        MeasurementMNode node1 = (MeasurementMNode) mtree.getNodeByPath(seriesPath);
+        node1.updateCachedLast(timeValuePair, highPriorityUpdate, latestFlushedTime);
+      } catch (MetadataException e) {
+        logger.warn("the {} is not exist", seriesPath);
+      }
+    }
+  }
+
+  public TimeValuePair getLastCache(String seriesPath) {
+   try {
+     MeasurementMNode node = null;
+     node = (MeasurementMNode) mtree.getNodeByPath(seriesPath);
+     return node.getCachedLast();
+  } catch (MetadataException e) {
+     // do nothing
+  }
+  return null;

Review comment:
       please log the exception and format the code

##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
##########
@@ -785,8 +785,12 @@ private void tryToUpdateBatchInsertLastCache(InsertTabletPlan plan, Long latestF
         continue;
       }
       // Update cached last value with high priority
-      ((MeasurementMNode) node.getChild(measurementList[i]))
-          .updateCachedLast(plan.composeLastTimeValuePair(i), true, latestFlushedTime);
+      MeasurementMNode tmpMeasurementNode = null;
+      if (node != null) {
+        tmpMeasurementNode = (MeasurementMNode) node.getChild(measurementList[i]);
+      }
+      IoTDB.metaManager.updateLastCache(node.getFullPath() + IoTDBConstant.PATH_SEPARATOR + measurementList[i],

Review comment:
       The String concat is an overhead in single node IoTDB, could we avoid this?




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org