This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch dev/1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/dev/1.3 by this push:
new 212df13a0b6 [To dev/1.3] Change sort_buffer_size_in_bytes default value
212df13a0b6 is described below
commit 212df13a0b6715b2bf5944be9ce5fb3e3e2e5513
Author: Jackie Tien <[email protected]>
AuthorDate: Tue Jul 29 16:33:45 2025 +0800
[To dev/1.3] Change sort_buffer_size_in_bytes default value
(cherry picked from commit 2459e5211ce7ded5a355ff6d96abbdcda10700f9)
---
.../java/org/apache/iotdb/db/conf/IoTDBConfig.java | 2 +-
.../org/apache/iotdb/db/conf/IoTDBDescriptor.java | 27 ++++++++++++++++++----
.../conf/iotdb-system.properties.template | 6 +++--
3 files changed, 27 insertions(+), 8 deletions(-)
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 007f45755ab..531fa7f543f 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
@@ -452,7 +452,7 @@ public class IoTDBConfig {
private volatile boolean enableAutoRepairCompaction = true;
/** The buffer for sort operation */
- private long sortBufferSize = 1024 * 1024L;
+ private long sortBufferSize = 32 * 1024 * 1024L;
/**
* The strategy of inner space compaction task. There are just one inner
space compaction strategy
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 7fbd9ce2ed7..7c61bab1a1f 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
@@ -1080,11 +1080,8 @@ public class IoTDBDescriptor {
properties.getProperty("quota_enable",
String.valueOf(conf.isQuotaEnable()))));
// The buffer for sort operator to calculate
- conf.setSortBufferSize(
- Long.parseLong(
- properties
- .getProperty("sort_buffer_size_in_bytes",
Long.toString(conf.getSortBufferSize()))
- .trim()));
+
+ loadSortBuffer(properties);
// tmp filePath for sort operator
conf.setSortTmpDir(properties.getProperty("sort_tmp_dir",
conf.getSortTmpDir()));
@@ -1109,6 +1106,23 @@ public class IoTDBDescriptor {
loadTrustedUriPattern(properties);
}
+ private void loadSortBuffer(TrimProperties properties) {
+ long defaultValue = calculateDefaultSortBufferSize();
+ long sortBufferSize =
+ Long.parseLong(
+ properties.getProperty("sort_buffer_size_in_bytes",
Long.toString(defaultValue)));
+ if (sortBufferSize <= 0) {
+ sortBufferSize = defaultValue;
+ }
+ // The buffer for sort operator to calculate
+ conf.setSortBufferSize(sortBufferSize);
+ }
+
+ public static long calculateDefaultSortBufferSize() {
+ return Math.min(
+ 32 * 1024 * 1024L, conf.getAllocateMemoryForOperators() /
conf.getQueryThreadCount() / 2);
+ }
+
private void reloadConsensusProps(TrimProperties properties) throws
IOException {
loadIoTConsensusProps(properties);
loadPipeConsensusProps(properties);
@@ -2042,6 +2056,9 @@ public class IoTDBDescriptor {
properties.getProperty(
"tvlist_sort_threshold",
ConfigurationFileUtils.getConfigurationDefaultValue("tvlist_sort_threshold"))));
+
+ // sort_buffer_size_in_bytes
+ loadSortBuffer(properties);
} catch (Exception e) {
if (e instanceof InterruptedException) {
Thread.currentThread().interrupt();
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 f2fa57164f5..70bd7e15113 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
@@ -1061,9 +1061,11 @@ mode_map_size_threshold=10000
batch_size=100000
# The memory for external sort in sort operator, when the data size is smaller
than sort_buffer_size_in_bytes, the sort operator will use in-memory sort.
-# effectiveMode: restart
+# if sort_buffer_size_in_bytes <= 0, default value will be used, default value
= min(32MB, memory for query operators / query_thread_count / 2)
+# if sort_buffer_size_in_bytes > 0, the specified value will be used.
+# effectiveMode: hot_reload
# Datatype: long
-sort_buffer_size_in_bytes=1048576
+sort_buffer_size_in_bytes=0
# The threshold of operator count in the result set of EXPLAIN ANALYZE, if the
number of operator in the result set is larger than this threshold, operator
will be merged.
# effectiveMode: hot_reload