Skip to content

Commit 23192f0

Browse files
committed
fix
1 parent f543ad1 commit 23192f0

File tree

7 files changed

+335
-143
lines changed

7 files changed

+335
-143
lines changed

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,21 @@ public class IoTDBConfig {
11211121

11221122
private int loadTsFileSpiltPartitionMaxSize = 10;
11231123

1124+
/**
1125+
* The threshold for splitting statement when loading multiple TsFiles. When the number of TsFiles
1126+
* exceeds this threshold, the statement will be split into multiple sub-statements for batch
1127+
* execution to limit resource consumption during statement analysis. Default value is 10, which
1128+
* means splitting will occur when there are more than 10 files.
1129+
*/
1130+
private int loadTsFileStatementSplitThreshold = 10;
1131+
1132+
/**
1133+
* The number of TsFiles that each sub-statement handles when splitting a statement. This
1134+
* parameter controls how many files are grouped together in each sub-statement during batch
1135+
* execution. Default value is 10, which means each sub-statement handles 10 files.
1136+
*/
1137+
private int loadTsFileSubStatementBatchSize = 10;
1138+
11241139
private String[] loadActiveListeningDirs =
11251140
new String[] {
11261141
IoTDBConstant.EXT_FOLDER_NAME
@@ -4056,6 +4071,46 @@ public void setLoadTsFileSpiltPartitionMaxSize(int loadTsFileSpiltPartitionMaxSi
40564071
this.loadTsFileSpiltPartitionMaxSize = loadTsFileSpiltPartitionMaxSize;
40574072
}
40584073

4074+
public int getLoadTsFileStatementSplitThreshold() {
4075+
return loadTsFileStatementSplitThreshold;
4076+
}
4077+
4078+
public void setLoadTsFileStatementSplitThreshold(final int loadTsFileStatementSplitThreshold) {
4079+
if (loadTsFileStatementSplitThreshold < 0) {
4080+
logger.warn(
4081+
"Invalid loadTsFileStatementSplitThreshold value: {}. Using default value: 10",
4082+
loadTsFileStatementSplitThreshold);
4083+
return;
4084+
}
4085+
if (this.loadTsFileStatementSplitThreshold != loadTsFileStatementSplitThreshold) {
4086+
logger.info(
4087+
"loadTsFileStatementSplitThreshold changed from {} to {}",
4088+
this.loadTsFileStatementSplitThreshold,
4089+
loadTsFileStatementSplitThreshold);
4090+
}
4091+
this.loadTsFileStatementSplitThreshold = loadTsFileStatementSplitThreshold;
4092+
}
4093+
4094+
public int getLoadTsFileSubStatementBatchSize() {
4095+
return loadTsFileSubStatementBatchSize;
4096+
}
4097+
4098+
public void setLoadTsFileSubStatementBatchSize(final int loadTsFileSubStatementBatchSize) {
4099+
if (loadTsFileSubStatementBatchSize <= 0) {
4100+
logger.warn(
4101+
"Invalid loadTsFileSubStatementBatchSize value: {}. Using default value: 10",
4102+
loadTsFileSubStatementBatchSize);
4103+
return;
4104+
}
4105+
if (this.loadTsFileSubStatementBatchSize != loadTsFileSubStatementBatchSize) {
4106+
logger.info(
4107+
"loadTsFileSubStatementBatchSize changed from {} to {}",
4108+
this.loadTsFileSubStatementBatchSize,
4109+
loadTsFileSubStatementBatchSize);
4110+
}
4111+
this.loadTsFileSubStatementBatchSize = loadTsFileSubStatementBatchSize;
4112+
}
4113+
40594114
public String[] getPipeReceiverFileDirs() {
40604115
return (Objects.isNull(this.pipeReceiverFileDirs) || this.pipeReceiverFileDirs.length == 0)
40614116
? new String[] {systemDir + File.separator + "pipe" + File.separator + "receiver"}

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2395,6 +2395,18 @@ private void loadLoadTsFileProps(TrimProperties properties) {
23952395
properties.getProperty(
23962396
"skip_failed_table_schema_check",
23972397
String.valueOf(conf.isSkipFailedTableSchemaCheck()))));
2398+
2399+
conf.setLoadTsFileStatementSplitThreshold(
2400+
Integer.parseInt(
2401+
properties.getProperty(
2402+
"load_tsfile_statement_split_threshold",
2403+
Integer.toString(conf.getLoadTsFileStatementSplitThreshold()))));
2404+
2405+
conf.setLoadTsFileSubStatementBatchSize(
2406+
Integer.parseInt(
2407+
properties.getProperty(
2408+
"load_tsfile_sub_statement_batch_size",
2409+
Integer.toString(conf.getLoadTsFileSubStatementBatchSize()))));
23982410
}
23992411

24002412
private void loadLoadTsFileHotModifiedProp(TrimProperties properties) throws IOException {
@@ -2443,6 +2455,18 @@ private void loadLoadTsFileHotModifiedProp(TrimProperties properties) throws IOE
24432455
"load_tsfile_split_partition_max_size",
24442456
Integer.toString(conf.getLoadTsFileSpiltPartitionMaxSize()))));
24452457

2458+
conf.setLoadTsFileStatementSplitThreshold(
2459+
Integer.parseInt(
2460+
properties.getProperty(
2461+
"load_tsfile_statement_split_threshold",
2462+
Integer.toString(conf.getLoadTsFileStatementSplitThreshold()))));
2463+
2464+
conf.setLoadTsFileSubStatementBatchSize(
2465+
Integer.parseInt(
2466+
properties.getProperty(
2467+
"load_tsfile_sub_statement_batch_size",
2468+
Integer.toString(conf.getLoadTsFileSubStatementBatchSize()))));
2469+
24462470
conf.setSkipFailedTableSchemaCheck(
24472471
Boolean.parseBoolean(
24482472
properties.getProperty(

0 commit comments

Comments
 (0)