Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

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);
Expand Down Expand Up @@ -110,7 +112,8 @@ public void runMayThrow() {
// 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
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;
Expand Down Expand Up @@ -204,6 +205,7 @@ public void updateFailedStatValue() {
globalSeriesValue.set(2, globalSeriesValue.get(2) + 1);
}

@TestOnly
public void close() {
config.setEnableStatMonitor(false);
config.setEnableMonitorSeriesWrite(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,17 @@ public void setUp() throws Exception {
@After
public void tearDown() throws IOException, StorageEngineException {
// reset setEnableStatMonitor to false
config.setEnableStatMonitor(false);
config.setEnableMonitorSeriesWrite(false);

statMonitor.close();
EnvironmentUtils.cleanEnv();
}

@Test
public void completeTest() throws Exception {
getValueInMemoryTest();
statMonitor.saveStatValue("root.sg");
saveStatValueTest();

// restart server
Expand Down Expand Up @@ -113,8 +117,6 @@ private void getValueInMemoryTest() {
}

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");
Expand Down