Skip to content

Load: Support Active Load TSFile - #15208

Merged
SteveYurongSu merged 13 commits into
apache:masterfrom
luoluoyuyu:async-load
Mar 28, 2025
Merged

Load: Support Active Load TSFile#15208
SteveYurongSu merged 13 commits into
apache:masterfrom
luoluoyuyu:async-load

Conversation

@luoluoyuyu

Copy link
Copy Markdown
Member

Description

As the title said


This PR has:

  • been self-reviewed.
    • concurrent read
    • concurrent write
    • concurrent read and write
  • added documentation for new or modified features or behaviors.
  • added Javadocs for most classes and all non-trivial methods.
  • added or updated version, license, or notice information
  • added comments explaining the "why" and the intent of the code wherever would not be obvious
    for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold
    for code coverage.
  • added integration tests.
  • been tested in a test IoTDB cluster.

Key changed/added classes (or packages if there are too many classes) in this PR

@SteveYurongSuSteveYurongSu self-assigned this Mar 27, 2025

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces support for asynchronous loading of TSFiles into the IoTDB system (“Active Load TSFile”) by adding new asynchronous loading logic and configuration parameters.

  • Added async load logic and related methods in LoadTsFileAnalyzer.
  • Introduced new async load configuration and validation in LoadTsFileConfigurator.
  • Updated receiver and statement classes to propagate and utilize the async load flag.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

FileDescription
LoadTsFileAnalyzer.javaAdded isAsyncLoad flag and async load methods to route file loading asynchronously.
LoadTsFileConfigurator.javaUpdated parameter validation and default parsing for async load, replacing the previous VERIFY_KEY usage.
ActiveLoadTsFileLoader.java & IoTDBDataNodeReceiver.javaAdjustments to support asynchronous file movement and target directory assignment.
LoadTsFile.java & LoadTsFileStatement.javaAdded async load flag and corresponding getter to support the new async loading feature.
Comments suppressed due to low confidence (3)

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/config/LoadTsFileConfigurator.java:53

  • Using ASYNC_LOAD_KEY in the validateParameters switch may lead to confusion between the async load and verify schema configurations. If these are intended to be separate, consider using distinct keys and validation methods.
case ASYNC_LOAD_KEY:

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/config/LoadTsFileConfigurator.java:155

  • The error message in validateVerifyParam now references ASYNC_LOAD_KEY instead of VERIFY_KEY. Verify that this change reflects the intended behavior and does not conflate the async load and schema verification settings.
throw new SemanticException(String.format("Given %s value '%s' is not supported, please input a valid boolean value.", ASYNC_LOAD_KEY, verify));

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/load/LoadTsFileAnalyzer.java:207

  • [nitpick] The newly introduced boolean flag 'isAsyncLoad' may be confused with the previous 'verify' configuration. Consider adding clarifying comments or renaming the flag if it represents a significantly distinct behavior.
if (isAsyncLoad) {

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for asynchronous loading of TSFiles by introducing new configuration options and related code paths. Key changes include:

  • Adding the async-load parameter and its validation in LoadTsFileConfigurator.
  • Modifying the ActiveLoadTsFileLoader and related components to support an asynchronous session-based TSFile loading.
  • Updating LoadTsFileStatement, LoadTsFile, and LoadTsFileAnalyzer to propagate and handle the new async-load behavior.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/utils/FileUtils.javaIntroduces asynchronous file copy methods with MD5 checking and renaming.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/config/LoadTsFileConfigurator.javaAdds async-load parameter validation and default value parsing.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/active/ActiveLoadTsFileLoader.javaExtends TSFile loading methods to accept a session for asynchronous load.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/LoadTsFileStatement.javaPropagates the async-load configuration in the TSFile load statement.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/LoadTsFile.javaAdds support for async-load flag in the statement representation.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/load/LoadTsFileAnalyzer.javaImplements asynchronous TSFile load processing using the new async-load config.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/thrift/IoTDBDataNodeReceiver.javaAdjusts file move logic to support async TSFile loading to a configurable target directory.
Comments suppressed due to low confidence (1)

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/thrift/IoTDBDataNodeReceiver.java:590

  • Comparing file paths using getAbsolutePath() may lead to mismatches if the paths have differences in representation (e.g., trailing slashes). Consider normalizing the paths before comparison to avoid unexpected behavior.
if (!Objects.equals(targetDir.getAbsolutePath(), sourceFile.getParentFile().getAbsolutePath())) {

}

private TSStatus loadTsFile(final Pair<String, Boolean> filePair) throws FileNotFoundException {
private TSStatus loadTsFile(final Pair<String, Boolean> filePair, final IClientSession session)

CopilotAIMar 28, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The signature change for loadTsFile now requires all call sites to pass the session argument. Please ensure that all usages are updated accordingly and that unit tests cover the new behavior.

Copilot uses AI. Check for mistakes.
targetDir.getAbsolutePath());
}
} else {
if (!(targetDir.exists() || targetDir.mkdirs())) {

CopilotAIMar 28, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current directory creation check may not be robust in concurrent scenarios. Consider using Files.createDirectories for an atomic and more reliable directory creation.

Suggested change
if (!(targetDir.exists() || targetDir.mkdirs())) {
try {
Files.createDirectories(targetDir.toPath());
} catch (IOExceptione) {

Copilot uses AI. Check for mistakes.
@SteveYurongSu
SteveYurongSu merged commit 7e4e01c into apache:masterMar 28, 2025
@luoluoyuyu
luoluoyuyu deleted the async-load branch April 10, 2025 09:34
luoluoyuyu added a commit to luoluoyuyu/iotdb that referenced this pull request Apr 11, 2025
…Load in SQL & Support Async Load Strategy in Pipe (apache#15208)
Co-authored-by: Steve Yurong Su <rong@apache.org>
JackieTien97 pushed a commit that referenced this pull request Apr 14, 2025
…Load in SQL & Support Async Load Strategy in Pipe (#15208)
Co-authored-by: Steve Yurong Su <rong@apache.org>
(cherry picked from commit 7e4e01c)
SteveYurongSu added a commit that referenced this pull request Apr 22, 2025
* Load & Pipe: Support Active Load Table Model TsFiles & Support Async Load in SQL & Support Async Load Strategy in Pipe (#15208)
---------
Co-authored-by: Steve Yurong Su <rong@apache.org>
Caideyipi pushed a commit to Caideyipi/iotdb that referenced this pull request Mar 25, 2026
* Load & Pipe: Support Active Load Table Model TsFiles & Support Async Load in SQL & Support Async Load Strategy in Pipe (apache#15208)
---------
Co-authored-by: Steve Yurong Su <rong@apache.org>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@luoluoyuyu@SteveYurongSu