This is an automated email from the ASF dual-hosted git repository.
hxd pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new fa86482 Fix monitor bug caused by virtual storage group name (#2852)
fa86482 is described below
commit fa8648229854908ec5f892c848f45da93231b677
Author: SilverNarcissus <[email protected]>
AuthorDate: Thu Apr 1 15:04:17 2021 +0800
Fix monitor bug caused by virtual storage group name (#2852)
---
.../main/java/org/apache/iotdb/db/engine/flush/FlushManager.java | 5 ++++-
server/src/main/java/org/apache/iotdb/db/monitor/StatMonitor.java | 2 ++
.../test/java/org/apache/iotdb/db/monitor/IoTDBStatMonitorTest.java | 6 ++++--
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git
a/server/src/main/java/org/apache/iotdb/db/engine/flush/FlushManager.java
b/server/src/main/java/org/apache/iotdb/db/engine/flush/FlushManager.java
index a741f93..b663999 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/flush/FlushManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/flush/FlushManager.java
@@ -37,6 +37,8 @@ import org.slf4j.LoggerFactory;
import java.util.concurrent.ConcurrentLinkedDeque;
+import static java.io.File.separator;
+
public class FlushManager implements FlushManagerMBean, IService {
private static final Logger LOGGER =
LoggerFactory.getLogger(FlushManager.class);
@@ -110,7 +112,8 @@ public class FlushManager implements FlushManagerMBean,
IService {
// update stat monitor cache to system during each flush()
if (config.isEnableStatMonitor() && config.isEnableMonitorSeriesWrite())
{
try {
-
StatMonitor.getInstance().saveStatValue(tsFileProcessor.getStorageGroupName());
+ StatMonitor.getInstance()
+
.saveStatValue(tsFileProcessor.getStorageGroupName().split(separator)[0]);
} catch (StorageEngineException | MetadataException e) {
LOGGER.error("Inserting monitor series data error.", e);
}
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 497337a..03a8b10 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
@@ -40,6 +40,7 @@ import org.apache.iotdb.db.service.IService;
import org.apache.iotdb.db.service.IoTDB;
import org.apache.iotdb.db.service.JMXService;
import org.apache.iotdb.db.service.ServiceType;
+import org.apache.iotdb.db.utils.TestOnly;
import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
@@ -204,6 +205,7 @@ public class StatMonitor implements StatMonitorMBean,
IService {
globalSeriesValue.set(2, globalSeriesValue.get(2) + 1);
}
+ @TestOnly
public void close() {
config.setEnableStatMonitor(false);
config.setEnableMonitorSeriesWrite(false);
diff --git
a/server/src/test/java/org/apache/iotdb/db/monitor/IoTDBStatMonitorTest.java
b/server/src/test/java/org/apache/iotdb/db/monitor/IoTDBStatMonitorTest.java
index 18067fc..cf39984 100644
--- a/server/src/test/java/org/apache/iotdb/db/monitor/IoTDBStatMonitorTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/monitor/IoTDBStatMonitorTest.java
@@ -73,6 +73,9 @@ public class IoTDBStatMonitorTest {
@After
public void tearDown() throws IOException, StorageEngineException {
// reset setEnableStatMonitor to false
+ config.setEnableStatMonitor(false);
+ config.setEnableMonitorSeriesWrite(false);
+
statMonitor.close();
EnvironmentUtils.cleanEnv();
}
@@ -80,6 +83,7 @@ public class IoTDBStatMonitorTest {
@Test
public void completeTest() throws Exception {
getValueInMemoryTest();
+ statMonitor.saveStatValue("root.sg");
saveStatValueTest();
// restart server
@@ -113,8 +117,6 @@ public class IoTDBStatMonitorTest {
}
private void saveStatValueTest() throws MetadataException,
StorageEngineException {
- statMonitor.saveStatValue(STORAGE_GROUP_NAME);
-
try (Connection connection =
DriverManager.getConnection(
Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");