This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch object_type
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/object_type by this push:
new b5642ad6e6a add 4G file limit
b5642ad6e6a is described below
commit b5642ad6e6a34b3abb6431914bcb2c002af9e7ae
Author: HTHou <[email protected]>
AuthorDate: Mon Jul 7 11:49:20 2025 +0800
add 4G file limit
---
.../src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java | 10 ++++++++++
.../main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java | 10 ++++++++++
.../src/main/java/org/apache/iotdb/db/utils/ObjectWriter.java | 9 ++++++++-
.../assembly/resources/conf/iotdb-system.properties.template | 6 ++++++
4 files changed, 34 insertions(+), 1 deletion(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
index 8137959a391..afd957cbf6b 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
@@ -1162,6 +1162,8 @@ public class IoTDBConfig {
private long cacheLastValuesMemoryBudgetInByte = 4 * 1024 * 1024;
+ private long maxObjectSizeInByte = 4 * 1024 * 1024 * 1024L;
+
IoTDBConfig() {}
public int getMaxLogEntriesNumPerBatch() {
@@ -4116,4 +4118,12 @@ public class IoTDBConfig {
public void setCacheLastValuesMemoryBudgetInByte(long
cacheLastValuesMemoryBudgetInByte) {
this.cacheLastValuesMemoryBudgetInByte = cacheLastValuesMemoryBudgetInByte;
}
+
+ public long getMaxObjectSizeInByte() {
+ return maxObjectSizeInByte;
+ }
+
+ public void setMaxObjectSizeInByte(long maxObjectSizeInByte) {
+ this.maxObjectSizeInByte = maxObjectSizeInByte;
+ }
}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
index a4d199f662d..f74cd528340 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
@@ -897,6 +897,11 @@ public class IoTDBDescriptor {
conf.setExtPipeDir(properties.getProperty("ext_pipe_dir",
conf.getExtPipeDir()));
+ conf.setMaxObjectSizeInByte(
+ Long.parseLong(
+ properties.getProperty(
+ "max_object_file_size_in_byte",
String.valueOf(conf.getMaxObjectSizeInByte()))));
+
// At the same time, set TSFileConfig
List<FSType> fsTypes = new ArrayList<>();
fsTypes.add(FSType.LOCAL);
@@ -2056,6 +2061,11 @@ public class IoTDBDescriptor {
properties.getProperty(
"tvlist_sort_threshold",
ConfigurationFileUtils.getConfigurationDefaultValue("tvlist_sort_threshold"))));
+
+ conf.setMaxObjectSizeInByte(
+ Long.parseLong(
+ properties.getProperty(
+ "max_object_file_size_in_byte",
String.valueOf(conf.getMaxObjectSizeInByte()))));
} catch (Exception e) {
if (e instanceof InterruptedException) {
Thread.currentThread().interrupt();
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ObjectWriter.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ObjectWriter.java
index c8fde82b166..a483f0d7c2d 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ObjectWriter.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ObjectWriter.java
@@ -19,6 +19,8 @@
package org.apache.iotdb.db.utils;
+import org.apache.iotdb.db.conf.IoTDBConfig;
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.write.FileNode;
import org.apache.commons.io.FileUtils;
@@ -35,6 +37,8 @@ public class ObjectWriter implements AutoCloseable {
private static final Logger LOGGER =
LoggerFactory.getLogger(ObjectWriter.class);
+ private static final IoTDBConfig config =
IoTDBDescriptor.getInstance().getConfig();
+
private final FileOutputStream fos;
private final File file;
@@ -58,7 +62,10 @@ public class ObjectWriter implements AutoCloseable {
public void write(FileNode fileNode) throws IOException {
if (file.length() != fileNode.getOffset()) {
- throw new IOException("the file length is not equal to the file offset");
+ throw new IOException("The file length is not equal to the file offset");
+ }
+ if (file.length() + fileNode.getContent().length >
config.getMaxObjectSizeInByte()) {
+ throw new IOException("The file length is too large");
}
fos.write(fileNode.getContent());
}
diff --git
a/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template
b/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template
index 28af70751ba..8c0d28a2332 100644
---
a/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template
+++
b/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template
@@ -1246,6 +1246,12 @@ enable_tsfile_validation=false
# Unit: ms
tier_ttl_in_ms=-1
+
+# The maximum size limit for a single object file.
+# effectiveMode: hot_reload
+# Datatype: long
+max_object_file_size_in_byte=4294967296
+
####################
### Compaction Configurations
####################