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

spricoder pushed a commit to branch feature/optimize_memory
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/feature/optimize_memory by 
this push:
     new 2a4c2752831 move buffer pool to memtable
2a4c2752831 is described below

commit 2a4c27528314bed556ce9d73bf6c6d5421ff734d
Author: spricoder <[email protected]>
AuthorDate: Mon Dec 30 19:13:48 2024 +0800

    move buffer pool to memtable
---
 .../metrics/memory/ThresholdMemoryMetrics.java     | 32 ++++++++++++----------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/memory/ThresholdMemoryMetrics.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/memory/ThresholdMemoryMetrics.java
index ce836d6c79f..580a56351ec 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/memory/ThresholdMemoryMetrics.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/memory/ThresholdMemoryMetrics.java
@@ -43,8 +43,8 @@ public class ThresholdMemoryMetrics implements IMetricSet {
   private Gauge writeMemorySize = DoNothingMetricManager.DO_NOTHING_GAUGE;
   private Gauge memtableMemorySize = DoNothingMetricManager.DO_NOTHING_GAUGE;
   private Gauge dataNodeDevicePathCacheMemorySize = 
DoNothingMetricManager.DO_NOTHING_GAUGE;
-  private Gauge timePartitionInfoMemorySize = 
DoNothingMetricManager.DO_NOTHING_GAUGE;
   private Gauge bufferedArraysMemorySize = 
DoNothingMetricManager.DO_NOTHING_GAUGE;
+  private Gauge timePartitionInfoMemorySize = 
DoNothingMetricManager.DO_NOTHING_GAUGE;
   private Gauge compactionMemorySize = DoNothingMetricManager.DO_NOTHING_GAUGE;
   private Gauge queryEngineMemorySize = 
DoNothingMetricManager.DO_NOTHING_GAUGE;
   private Gauge schemaEngineMemorySize = 
DoNothingMetricManager.DO_NOTHING_GAUGE;
@@ -60,10 +60,10 @@ public class ThresholdMemoryMetrics implements IMetricSet {
   private static final String STORAGE_ENGINE_WRITE_MEMTABLE = 
"StorageEngine-Write-Memtable";
   private static final String STORAGE_ENGINE_WRITE_MEMTABLE_CACHE =
       "StorageEngine-Write-Memtable-DevicePathCache";
+  private static final String STORAGE_ENGINE_WRITE_MEMTABLE_BUFFERED_ARRAYS =
+      "StorageEngine-Write-Memtable-BufferedArrays";
   private static final String STORAGE_ENGINE_WRITE_TIME_PARTITION_INFO =
       "StorageEngine-Write-TimePartitionInfo";
-  private static final String STORAGE_ENGINE_WRITE_BUFFERED_ARRAYS =
-      "StorageEngine-Write-BufferedArrays";
   private static final String STORAGE_ENGINE_COMPACTION = 
"StorageEngine-Compaction";
   private static final String QUERY_ENGINE = "QueryEngine";
   private static final String SCHEMA_ENGINE = "SchemaEngine";
@@ -222,28 +222,28 @@ public class ThresholdMemoryMetrics implements IMetricSet 
{
             Tag.LEVEL.toString(),
             LEVELS[4]);
     dataNodeDevicePathCacheMemorySize.set(dataNodeDevicePathCacheSize);
-    timePartitionInfoMemorySize =
+    bufferedArraysMemorySize =
         metricService.getOrCreateGauge(
             Metric.THRESHOLD_MEMORY_SIZE.toString(),
             MetricLevel.NORMAL,
             Tag.NAME.toString(),
-            STORAGE_ENGINE_WRITE_TIME_PARTITION_INFO,
+            STORAGE_ENGINE_WRITE_MEMTABLE_BUFFERED_ARRAYS,
             Tag.TYPE.toString(),
             ON_HEAP,
             Tag.LEVEL.toString(),
-            LEVELS[3]);
-    timePartitionInfoMemorySize.set(timePartitionInfoSize);
-    bufferedArraysMemorySize =
+            LEVELS[4]);
+    bufferedArraysMemorySize.set(bufferedArraySize);
+    timePartitionInfoMemorySize =
         metricService.getOrCreateGauge(
             Metric.THRESHOLD_MEMORY_SIZE.toString(),
             MetricLevel.NORMAL,
             Tag.NAME.toString(),
-            STORAGE_ENGINE_WRITE_BUFFERED_ARRAYS,
+            STORAGE_ENGINE_WRITE_TIME_PARTITION_INFO,
             Tag.TYPE.toString(),
             ON_HEAP,
             Tag.LEVEL.toString(),
             LEVELS[3]);
-    bufferedArraysMemorySize.set(bufferedArraySize);
+    timePartitionInfoMemorySize.set(timePartitionInfoSize);
   }
 
   @Override
@@ -288,6 +288,10 @@ public class ThresholdMemoryMetrics implements IMetricSet {
                     OFF_HEAP,
                     Tag.LEVEL.toString(),
                     LEVELS[1]));
+    unbindStorageEngineRelatedMemoryMetrics(metricService);
+  }
+
+  private void unbindStorageEngineRelatedMemoryMetrics(AbstractMetricService 
metricService) {
     writeMemorySize = DoNothingMetricManager.DO_NOTHING_GAUGE;
     compactionMemorySize = DoNothingMetricManager.DO_NOTHING_GAUGE;
     Arrays.asList(STORAGE_ENGINE_WRITE, STORAGE_ENGINE_COMPACTION)
@@ -305,10 +309,7 @@ public class ThresholdMemoryMetrics implements IMetricSet {
     memtableMemorySize = DoNothingMetricManager.DO_NOTHING_GAUGE;
     timePartitionInfoMemorySize = DoNothingMetricManager.DO_NOTHING_GAUGE;
     bufferedArraysMemorySize = DoNothingMetricManager.DO_NOTHING_GAUGE;
-    Arrays.asList(
-            STORAGE_ENGINE_WRITE_MEMTABLE,
-            STORAGE_ENGINE_WRITE_TIME_PARTITION_INFO,
-            STORAGE_ENGINE_WRITE_BUFFERED_ARRAYS)
+    Arrays.asList(STORAGE_ENGINE_WRITE_MEMTABLE, 
STORAGE_ENGINE_WRITE_TIME_PARTITION_INFO)
         .forEach(
             name ->
                 metricService.remove(
@@ -321,7 +322,8 @@ public class ThresholdMemoryMetrics implements IMetricSet {
                     Tag.LEVEL.toString(),
                     LEVELS[3]));
     dataNodeDevicePathCacheMemorySize = 
DoNothingMetricManager.DO_NOTHING_GAUGE;
-    Collections.singletonList(STORAGE_ENGINE_WRITE_MEMTABLE_CACHE)
+    Arrays.asList(
+            STORAGE_ENGINE_WRITE_MEMTABLE_CACHE, 
STORAGE_ENGINE_WRITE_MEMTABLE_BUFFERED_ARRAYS)
         .forEach(
             name ->
                 metricService.remove(

Reply via email to