Skip to content

[Load] Handle empty path nodes during database auto-creation - #18307

Merged
jt2594838 merged 3 commits into
apache:masterfrom
Caideyipi:fix/load-reject-illegal-device-path
Jul 27, 2026
Merged

[Load] Handle empty path nodes during database auto-creation#18307
jt2594838 merged 3 commits into
apache:masterfrom
Caideyipi:fix/load-reject-illegal-device-path

Conversation

@Caideyipi

@Caideyipi Caideyipi commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Description

A tree-model TsFile may contain a segmented device ID with an empty path node, for example root. represented as ["root", ""]. LOAD previously copied those segments into a PartialPath without structural validation and could derive an invalid root. database path.

Clusters affected by the old behavior may already contain such a legacy root. database. When LOAD listed existing databases, the previous string-prefix check treated valid candidates such as root.sg as covered by root., skipped their creation, and could make ordinary TsFiles fail to load.

This PR:

  • validates every device node before LOAD queries ConfigNode or attempts database auto-creation, so null or empty nodes fail locally with a clear illegal-path error;
  • ignores malformed legacy database names returned by ConfigNode when filtering databases to create, allowing ordinary TsFiles to load even if root. already exists;
  • compares database relationships by path nodes instead of raw string prefixes, so names such as root.sg and root.sg1 are not incorrectly treated as ancestors of one another.

The ConfigNode-wide guard that prevents new database paths with empty nodes is handled separately in #18308.

Tests

  • mvn spotless:apply -pl iotdb-core/datanode
  • LoadTsFileAnalyzerTest compiled against the current module dependencies and run with JUnitCore (7 tests passed).
  • The normal DataNode Maven lifecycle is currently blocked locally by unrelated stale generated Freemarker sources and SNAPSHOT dependency mismatches.

This PR has:

  • been self-reviewed.
  • added unit tests to cover the new code paths.
Key changed/added class
  • TreeSchemaAutoCreatorAndVerifier

@Caideyipi Caideyipi changed the title [Load] Reject illegal device paths before database auto-creation [Load] Reject device paths with empty nodes before database auto-creation Jul 25, 2026
@Caideyipi Caideyipi changed the title [Load] Reject device paths with empty nodes before database auto-creation [Load] Handle empty path nodes during database auto-creation Jul 27, 2026
@jt2594838
jt2594838 merged commit 39e2ad0 into apache:master Jul 27, 2026
40 of 41 checks passed
@jt2594838
jt2594838 deleted the fix/load-reject-illegal-device-path branch July 27, 2026 10:04
Sign up for free to 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.

2 participants