This is an automated email from the ASF dual-hosted git repository.

jackietien pushed a commit to branch new_vector
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/new_vector by this push:
     new 18fe326  fix all ci
18fe326 is described below

commit 18fe32641a7084563a7291b65a721b26746739be
Author: JackieTien97 <[email protected]>
AuthorDate: Thu Nov 11 20:34:14 2021 +0800

    fix all ci
---
 .../org/apache/iotdb/db/monitor/StatMonitor.java   | 30 ++++++++++++++--------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/monitor/StatMonitor.java 
b/server/src/main/java/org/apache/iotdb/db/monitor/StatMonitor.java
index 331e076..efc778c 100644
--- a/server/src/main/java/org/apache/iotdb/db/monitor/StatMonitor.java
+++ b/server/src/main/java/org/apache/iotdb/db/monitor/StatMonitor.java
@@ -30,6 +30,7 @@ import 
org.apache.iotdb.db.exception.metadata.IllegalPathException;
 import org.apache.iotdb.db.exception.metadata.MetadataException;
 import org.apache.iotdb.db.exception.query.QueryProcessException;
 import org.apache.iotdb.db.metadata.MManager;
+import org.apache.iotdb.db.metadata.path.MeasurementPath;
 import org.apache.iotdb.db.metadata.path.PartialPath;
 import org.apache.iotdb.db.monitor.MonitorConstants.StatMeasurementConstants;
 import org.apache.iotdb.db.qp.physical.crud.InsertRowPlan;
@@ -47,6 +48,7 @@ import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
 import org.apache.iotdb.tsfile.read.TimeValuePair;
 import org.apache.iotdb.tsfile.write.record.TSRecord;
 import org.apache.iotdb.tsfile.write.record.datapoint.LongDataPoint;
+import org.apache.iotdb.tsfile.write.schema.IMeasurementSchema;
 
 import org.apache.commons.io.FileUtils;
 import org.slf4j.Logger;
@@ -132,9 +134,13 @@ public class StatMonitor implements StatMonitorMBean, 
IService {
     try {
       for (int i = 0; i < globalSeries.size(); i++) {
         PartialPath globalMonitorPath = globalSeries.get(i);
-        TimeValuePair timeValuePair = getLastValue(globalMonitorPath);
-        if (timeValuePair != null) {
-          globalSeriesValue.set(i, timeValuePair.getValue().getLong());
+        if (mManager.isPathExist(globalMonitorPath)) {
+          IMeasurementSchema schema = 
mManager.getSeriesSchema(globalMonitorPath);
+          TimeValuePair timeValuePair =
+              getLastValue(new MeasurementPath(globalMonitorPath, schema));
+          if (timeValuePair != null) {
+            globalSeriesValue.set(i, timeValuePair.getValue().getLong());
+          }
         }
       }
 
@@ -144,16 +150,20 @@ public class StatMonitor implements StatMonitorMBean, 
IService {
           // for storage group which is not global, only TOTAL_POINTS is 
registered now
           PartialPath monitorSeriesPath =
               getStorageGroupMonitorSeries(storageGroupPath.getFullPath());
-          TimeValuePair timeValuePair = getLastValue(monitorSeriesPath);
-          if (timeValuePair != null) {
-            storageEngine
-                .getProcessorMap()
-                .get(storageGroupPath)
-                .setMonitorSeriesValue(timeValuePair.getValue().getLong());
+          if (mManager.isPathExist(monitorSeriesPath)) {
+            IMeasurementSchema schema = 
mManager.getSeriesSchema(monitorSeriesPath);
+            TimeValuePair timeValuePair =
+                getLastValue(new MeasurementPath(monitorSeriesPath, schema));
+            if (timeValuePair != null) {
+              storageEngine
+                  .getProcessorMap()
+                  .get(storageGroupPath)
+                  .setMonitorSeriesValue(timeValuePair.getValue().getLong());
+            }
           }
         }
       }
-    } catch (StorageEngineException | IOException | QueryProcessException e) {
+    } catch (StorageEngineException | IOException | QueryProcessException | 
MetadataException e) {
       logger.error("Load last value from disk error.", e);
     }
   }

Reply via email to