Skip to content

Fix PathPatternNode wildcard cache lifecycle - #18672

Open
Caideyipi wants to merge 1 commit into
apache:masterfrom
Caideyipi:fix-path-pattern-node-wildcard-cache
Open

Caideyipi wants to merge 1 commit into
apache:masterfrom
Caideyipi:fix-path-pattern-node-wildcard-cache

Conversation

@Caideyipi

@Caideyipi Caideyipi commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Description

PathPatternNode used to retain non-trivial wildcard child names and compile a regular expression on every match. This change caches the compiled Pattern objects instead.

  • Compile each non-trivial wildcard pattern when the child is added.
  • Reuse the compiled pattern in getMatchChildren.
  • Remove cached patterns when children are deleted or cleared, including replacement of an existing wildcard child.
  • Include the compiled-pattern cache in memory estimation.
  • Reuse the same compilation helper from PathPatternUtil.isNodeMatch.

Testing

mvn spotless:apply -pl iotdb-core/node-commons
mvn -pl iotdb-core/node-commons -Dtest=PathPatternNodeTest test

Result: BUILD SUCCESS; 2 tests passed. Checkstyle and Spotless checks passed.


This PR has:

  • been self-reviewed.
  • added comments explaining the intent of the cache.
  • added unit tests covering wildcard-cache add, replacement, deletion, and clear paths.

Key changed/added classes
  • PathPatternNode
  • PathPatternUtil
  • PathPatternNodeTest

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.

1 participant