-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Load: Fix excessive GC caused by loading too many TsFiles at once #16853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
jt2594838
reviewed
Dec 5, 2025
...re/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
Outdated
Show resolved
Hide resolved
...re/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
Outdated
Show resolved
Hide resolved
...re/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
Outdated
Show resolved
Hide resolved
...re/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
Outdated
Show resolved
Hide resolved
...tanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/LoadTsFile.java
Outdated
Show resolved
Hide resolved
...tanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/LoadTsFile.java
Show resolved
Hide resolved
jt2594838
pushed a commit
that referenced
this pull request
Dec 10, 2025
…s at once (#16853) (#16867) * 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. # Conflicts: # iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java # iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/LoadTsFile.java * fix # Conflicts: # iotdb-core/datanode/src/main/java/org/apache/iotdb/db/audit/AuditLogOperation.java # iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java # iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java # iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/LoadTsFile.java # iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/LoadTsFileStatement.java * update * update
JackieTien97
pushed a commit
that referenced
this pull request
Dec 10, 2025
…6853) * 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)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
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:
Changes:
This fix significantly reduces memory pressure and improves system stability when loading large numbers of TsFiles.
This PR has:
for an unfamiliar reader.
for code coverage.
Key changed/added classes (or packages if there are too many classes) in this PR