You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ta...@apache.org on 2023/03/06 13:20:43 UTC
[iotdb] branch remove_tsfile_after_flush updated: add memtable count
This is an automated email from the ASF dual-hosted git repository.
tanxinyu pushed a commit to branch remove_tsfile_after_flush
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/remove_tsfile_after_flush by this push:
new fd2767e03d add memtable count
fd2767e03d is described below
commit fd2767e03d0f99668ce36ee1e9600a3c366f26c0
Author: OneSizeFitQuorum <ta...@apache.org>
AuthorDate: Mon Mar 6 21:16:14 2023 +0800
add memtable count
Signed-off-by: OneSizeFitQuorum <ta...@apache.org>
---
.../org/apache/iotdb/commons/service/metric/enums/Metric.java | 4 +++-
.../apache/iotdb/db/engine/storagegroup/TsFileProcessorInfo.java | 8 ++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/service/metric/enums/Metric.java b/node-commons/src/main/java/org/apache/iotdb/commons/service/metric/enums/Metric.java
index c707e7683b..69b76f9c05 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/service/metric/enums/Metric.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/service/metric/enums/Metric.java
@@ -98,7 +98,9 @@ public enum Metric {
DATA_REGION_MEM_COST,
SCHEMA_REGION,
SCHEMA_ENGINE,
- SESSION_IDLE_TIME;
+ SESSION_IDLE_TIME,
+
+ MEMTABLE_COUNT;
@Override
public String toString() {
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessorInfo.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessorInfo.java
index d6cbcc7fdc..cfe55195b0 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessorInfo.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessorInfo.java
@@ -19,6 +19,8 @@
package org.apache.iotdb.db.engine.storagegroup;
import org.apache.iotdb.commons.service.metric.MetricService;
+import org.apache.iotdb.commons.service.metric.enums.Metric;
+import org.apache.iotdb.metrics.utils.MetricLevel;
/** The TsFileProcessorInfo records the memory cost of this TsFileProcessor. */
public class TsFileProcessorInfo {
@@ -36,6 +38,9 @@ public class TsFileProcessorInfo {
this.memCost = 0L;
this.metrics =
new TsFileProcessorInfoMetrics(dataRegionInfo.getDataRegion().getDatabaseName(), this);
+ MetricService.getInstance()
+ .getOrCreateGauge(Metric.MEMTABLE_COUNT.toString(), MetricLevel.CORE)
+ .incr(1);
MetricService.getInstance().addMetricSet(metrics);
}
@@ -56,6 +61,9 @@ public class TsFileProcessorInfo {
dataRegionInfo.releaseStorageGroupMemCost(memCost);
memCost = 0L;
MetricService.getInstance().removeMetricSet(metrics);
+ MetricService.getInstance()
+ .getOrCreateGauge(Metric.MEMTABLE_COUNT.toString(), MetricLevel.CORE)
+ .decr(1);
}
/** get memCost */