You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2023/03/06 02:05:40 UTC
[iotdb] 01/02: fix
This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch fix_time_partition
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit d7b0e2f7f629e25053ace84f881a1f3c40d47533
Author: HTHou <hh...@outlook.com>
AuthorDate: Fri Mar 3 22:52:09 2023 +0800
fix
---
.../main/java/org/apache/iotdb/it/env/cluster/MppCommonConfig.java | 6 ++++++
.../org/apache/iotdb/it/env/cluster/MppSharedCommonConfig.java | 7 +++++++
.../java/org/apache/iotdb/it/env/remote/RemoteCommonConfig.java | 5 +++++
.../src/main/java/org/apache/iotdb/itbase/env/CommonConfig.java | 2 ++
server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java | 2 +-
server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java | 5 +++--
.../apache/iotdb/db/engine/storagegroup/TimePartitionManager.java | 5 +++++
7 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/MppCommonConfig.java b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/MppCommonConfig.java
index c1bcbde4ec..fe9f3a6767 100644
--- a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/MppCommonConfig.java
+++ b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/MppCommonConfig.java
@@ -334,4 +334,10 @@ public class MppCommonConfig extends MppBaseConfig implements CommonConfig {
setProperty("schema_memory_allocate_proportion", String.valueOf(schemaMemoryAllocate));
return this;
}
+
+ @Override
+ public CommonConfig setWriteMemoryProportion(String writeMemoryProportion) {
+ setProperty("write_memory_proportion", writeMemoryProportion);
+ return this;
+ }
}
diff --git a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/MppSharedCommonConfig.java b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/MppSharedCommonConfig.java
index ddaba5a331..275ed1f8f8 100644
--- a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/MppSharedCommonConfig.java
+++ b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/MppSharedCommonConfig.java
@@ -343,4 +343,11 @@ public class MppSharedCommonConfig implements CommonConfig {
cnConfig.setSchemaMemoryAllocate(schemaMemoryAllocate);
return this;
}
+
+ @Override
+ public CommonConfig setWriteMemoryProportion(String writeMemoryProportion) {
+ dnConfig.setWriteMemoryProportion(writeMemoryProportion);
+ cnConfig.setWriteMemoryProportion(writeMemoryProportion);
+ return this;
+ }
}
diff --git a/integration-test/src/main/java/org/apache/iotdb/it/env/remote/RemoteCommonConfig.java b/integration-test/src/main/java/org/apache/iotdb/it/env/remote/RemoteCommonConfig.java
index 440b38253e..526df5dbab 100644
--- a/integration-test/src/main/java/org/apache/iotdb/it/env/remote/RemoteCommonConfig.java
+++ b/integration-test/src/main/java/org/apache/iotdb/it/env/remote/RemoteCommonConfig.java
@@ -246,4 +246,9 @@ public class RemoteCommonConfig implements CommonConfig {
public CommonConfig setSchemaMemoryAllocate(String schemaMemoryAllocate) {
return this;
}
+
+ @Override
+ public CommonConfig setWriteMemoryProportion(String writeMemoryProportion) {
+ return this;
+ }
}
diff --git a/integration-test/src/main/java/org/apache/iotdb/itbase/env/CommonConfig.java b/integration-test/src/main/java/org/apache/iotdb/itbase/env/CommonConfig.java
index 59dcd778ab..4792b8b3e7 100644
--- a/integration-test/src/main/java/org/apache/iotdb/itbase/env/CommonConfig.java
+++ b/integration-test/src/main/java/org/apache/iotdb/itbase/env/CommonConfig.java
@@ -110,4 +110,6 @@ public interface CommonConfig {
CommonConfig setSeriesSlotNum(int seriesSlotNum);
CommonConfig setSchemaMemoryAllocate(String schemaMemoryAllocate);
+
+ CommonConfig setWriteMemoryProportion(String writeMemoryProportion);
}
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
index 75a461b006..2cf7c2b9ec 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
@@ -517,7 +517,7 @@ public class IoTDBConfig {
private long allocateMemoryForTimeIndex = allocateMemoryForRead * 200 / 1001;
/** Memory allocated proportion for time partition info */
- private long allocateMemoryForTimePartitionInfo = allocateMemoryForStorageEngine * 50 / 1001;
+ private long allocateMemoryForTimePartitionInfo = 0;
/**
* If true, we will estimate each query's possible memory footprint before executing it and deny
* it if its estimated memory exceeds current free memory
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
index a4c40333ab..f83968c736 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
@@ -1606,13 +1606,14 @@ public class IoTDBDescriptor {
String allocationRatioForWrite = properties.getProperty("write_memory_proportion", "19:1");
proportions = allocationRatioForWrite.split(":");
- int proportionForMemTable = Integer.parseInt(proportions[0].trim());
+ int proportionForMemTable = Integer.parseInt(proportions[0].replace("\\", "").trim());
int proportionForTimePartitionInfo = Integer.parseInt(proportions[1].trim());
+ logger.info("proportionForTimePartitionInfo = {}", proportionForTimePartitionInfo);
double memtableProportionForWrite =
((double) (proportionForMemTable)
/ (double) (proportionForMemTable + proportionForTimePartitionInfo));
- Double.parseDouble(properties.getProperty("flush_time_memory_proportion", "0.05"));
+
double timePartitionInfoForWrite =
((double) (proportionForTimePartitionInfo)
/ (double) (proportionForMemTable + proportionForTimePartitionInfo));
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TimePartitionManager.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TimePartitionManager.java
index 1f77b36b82..18e65b8996 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TimePartitionManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TimePartitionManager.java
@@ -24,6 +24,9 @@ import org.apache.iotdb.commons.utils.TestOnly;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
import org.apache.iotdb.db.engine.StorageEngine;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
@@ -31,6 +34,7 @@ import java.util.TreeSet;
/** Manage all the time partitions for all data regions and control the total memory of them */
public class TimePartitionManager {
+ private static final Logger logger = LoggerFactory.getLogger(TimePartitionManager.class);
final Map<DataRegionId, Map<Long, TimePartitionInfo>> timePartitionInfoMap;
long memCost = 0;
@@ -74,6 +78,7 @@ public class TimePartitionManager {
memCost += memSize - timePartitionInfo.memSize;
timePartitionInfo.memSize = memSize;
timePartitionInfo.isActive = isActive;
+ logger.error("{}", timePartitionInfoMemoryThreshold);
if (memCost > timePartitionInfoMemoryThreshold) {
evictOldPartition();
}