Commit 8a903c8
Load: Fix excessive GC caused by loading too many TsFiles at once (#16853)
* Fix excessive GC caused by loading too many TsFiles at once
When loading multiple TsFiles, all file resources were loaded into memory
simultaneously, causing excessive memory consumption and frequent GC pauses.
This commit introduces batch execution for multi-file loading scenarios:
1. Split LoadTsFileStatement/LoadTsFile into sub-statements, each handling
one TsFile, to avoid loading all file resources at once
2. Refactor duplicate code in ClientRPCServiceImpl by extracting helper
methods for both tree model and table model
3. Add progress logging to track the loading status of each file
4. Support both synchronous and asynchronous loading modes
Changes:
- Added getSubStatement() method to LoadTsFileStatement and LoadTsFile
for splitting multi-file statements
- Extracted shouldSplitLoadTsFileStatement() and shouldSplitTableLoadTsFile()
to determine if splitting is needed
- Extracted executeBatchLoadTsFile() and executeBatchTableLoadTsFile()
to handle batch execution with progress logging
- Applied the optimization to 4 execution paths (tree/table model,
sync/async loading)
This fix significantly reduces memory pressure and improves system
stability when loading large numbers of TsFiles.
* fix
* update
(cherry picked from commit bc4f8e9)1 parent ce0e776 commit 8a903c8
File tree
7 files changed
+511
-44
lines changed- iotdb-core/datanode/src/main/java/org/apache/iotdb/db
- conf
- protocol/thrift/impl
- queryengine/plan
- relational/sql/ast
- statement
- crud
7 files changed
+511
-44
lines changedLines changed: 55 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1121 | 1121 | | |
1122 | 1122 | | |
1123 | 1123 | | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
1124 | 1139 | | |
1125 | 1140 | | |
1126 | 1141 | | |
| |||
4057 | 4072 | | |
4058 | 4073 | | |
4059 | 4074 | | |
| 4075 | + | |
| 4076 | + | |
| 4077 | + | |
| 4078 | + | |
| 4079 | + | |
| 4080 | + | |
| 4081 | + | |
| 4082 | + | |
| 4083 | + | |
| 4084 | + | |
| 4085 | + | |
| 4086 | + | |
| 4087 | + | |
| 4088 | + | |
| 4089 | + | |
| 4090 | + | |
| 4091 | + | |
| 4092 | + | |
| 4093 | + | |
| 4094 | + | |
| 4095 | + | |
| 4096 | + | |
| 4097 | + | |
| 4098 | + | |
| 4099 | + | |
| 4100 | + | |
| 4101 | + | |
| 4102 | + | |
| 4103 | + | |
| 4104 | + | |
| 4105 | + | |
| 4106 | + | |
| 4107 | + | |
| 4108 | + | |
| 4109 | + | |
| 4110 | + | |
| 4111 | + | |
| 4112 | + | |
| 4113 | + | |
| 4114 | + | |
4060 | 4115 | | |
4061 | 4116 | | |
4062 | 4117 | | |
| |||
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2406 | 2406 | | |
2407 | 2407 | | |
2408 | 2408 | | |
| 2409 | + | |
| 2410 | + | |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
| 2414 | + | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
2409 | 2421 | | |
2410 | 2422 | | |
2411 | 2423 | | |
| |||
2454 | 2466 | | |
2455 | 2467 | | |
2456 | 2468 | | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
| 2472 | + | |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + | |
| 2479 | + | |
| 2480 | + | |
2457 | 2481 | | |
2458 | 2482 | | |
2459 | 2483 | | |
| |||
0 commit comments