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

zyk 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 4ff204f00a8 Fix memory control when creating timeseries using schema 
template (#9952)
4ff204f00a8 is described below

commit 4ff204f00a8129966bbbdce132f1e4cc9fe98a1d
Author: Marcos_Zyk <[email protected]>
AuthorDate: Fri May 26 19:53:52 2023 +0800

    Fix memory control when creating timeseries using schema template (#9952)
---
 .../org/apache/iotdb/db/metadata/mnode/mem/info/BasicMNodeInfo.java   | 2 +-
 .../apache/iotdb/db/metadata/schemaregion/SchemaRegionMemoryImpl.java | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/metadata/mnode/mem/info/BasicMNodeInfo.java
 
b/server/src/main/java/org/apache/iotdb/db/metadata/mnode/mem/info/BasicMNodeInfo.java
index 49deac759ae..f278d292839 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/metadata/mnode/mem/info/BasicMNodeInfo.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/metadata/mnode/mem/info/BasicMNodeInfo.java
@@ -36,6 +36,6 @@ public class BasicMNodeInfo {
   public int estimateSize() {
     // object header, 8B
     // name reference, name length and name hash code, 8 + 4 + 4 = 16B
-    return 8 + 16;
+    return 8 + 16 + 2 * name.length();
   }
 }
diff --git 
a/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionMemoryImpl.java
 
b/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionMemoryImpl.java
index 347745ecf37..97297d962dc 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionMemoryImpl.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionMemoryImpl.java
@@ -1168,6 +1168,10 @@ public class SchemaRegionMemoryImpl implements 
ISchemaRegion {
   @Override
   public void activateSchemaTemplate(IActivateTemplateInClusterPlan plan, 
Template template)
       throws MetadataException {
+    if (!regionStatistics.isAllowToCreateNewSeries()) {
+      throw new SeriesOverflowException();
+    }
+
     try {
       getDeviceNodeWithAutoCreate(plan.getActivatePath());
 

Reply via email to