This is an automated email from the ASF dual-hosted git repository.
justinchen pushed a commit to branch c-ger-p
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/c-ger-p by this push:
new 102859d3177 part
102859d3177 is described below
commit 102859d31778a02a08974792fad2377a8c2915d3
Author: Caideyipi <[email protected]>
AuthorDate: Thu Apr 16 10:10:35 2026 +0800
part
---
.../protocol/thrift/impl/ClientRPCServiceImpl.java | 8 ---
.../apache/iotdb/commons/path/PathPatternTree.java | 61 +++++++++++++++-------
2 files changed, 42 insertions(+), 27 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
index 98da206e6f0..2ae50d36057 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
@@ -1042,14 +1042,6 @@ public class ClientRPCServiceImpl implements
IClientRPCServiceWithHandler {
}
}
- // cache miss
- Statement s = StatementGenerator.createStatement(convert(req));
- // permission check
- TSStatus status = AuthorityChecker.checkAuthority(s, clientSession);
- if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
- return RpcUtils.getTSExecuteStatementResp(status);
- }
-
quota =
DataNodeThrottleQuotaManager.getInstance()
.checkQuota(SESSION_MANAGER.getCurrSession().getUsername(), s);
diff --git
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/path/PathPatternTree.java
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/path/PathPatternTree.java
index 3b40a3b2ae2..d6290f339a5 100644
---
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/path/PathPatternTree.java
+++
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/path/PathPatternTree.java
@@ -37,6 +37,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.Set;
+import java.util.stream.Collectors;
public class PathPatternTree {
@@ -94,9 +95,17 @@ public class PathPatternTree {
appendBranchWithoutPrune(root, pathNodes, 0);
}
+ public void appendPathPattern(final PartialPath pathPattern) {
+ appendPathPattern(pathPattern, false);
+ }
+
/** Add a pathPattern (may contain wildcards) to pathPatternList. */
- public void appendPathPattern(PartialPath pathPattern) {
+ public void appendPathPattern(final PartialPath pathPattern, final boolean
isReload) {
if (useWildcard) {
+ // This does not guarantee multi-thread safety
+ if (isReload && (pathPatternList == null || pathPatternList.isEmpty())) {
+ pathPatternList = getAllPathPatterns();
+ }
boolean isExist = false;
for (PartialPath path : pathPatternList) {
if (path.include(pathPattern)) {
@@ -110,6 +119,9 @@ public class PathPatternTree {
pathPatternList.removeIf(pathPattern::include);
pathPatternList.add(pathPattern);
}
+ if (isReload) {
+ root.clear();
+ }
} else {
appendBranchWithoutPrune(root, pathPattern.getNodes(), 0);
}
@@ -120,7 +132,8 @@ public class PathPatternTree {
for (PartialPath path : pathPatternList) {
appendBranchWithoutPrune(root, path.getNodes(), 0);
}
- pathPatternList.clear();
+ // Do not clear to avoid concurrent modification
+ pathPatternList = new LinkedList<>();
}
private void appendBranchWithoutPrune(
@@ -245,16 +258,24 @@ public class PathPatternTree {
public List<PartialPath> getAllPathPatterns() {
List<PartialPath> result = new ArrayList<>();
Deque<String> ancestors = new ArrayDeque<>();
- searchPathPattern(root, ancestors, result);
+ searchPathPattern(root, ancestors, result, false);
+ return result;
+ }
+
+ public List<MeasurementPath> getAllPathPatterns(boolean asMeasurementPath) {
+ List<MeasurementPath> result = new ArrayList<>();
+ Deque<String> ancestors = new ArrayDeque<>();
+ searchPathPattern(root, ancestors, result, asMeasurementPath);
return result;
}
- private void searchPathPattern(
+ private <T extends PartialPath> void searchPathPattern(
PathPatternNode<Void, VoidSerializer> node,
Deque<String> ancestors,
- List<PartialPath> fullPaths) {
+ List<T> fullPaths,
+ boolean asMeasurementPath) {
if (node.isPathPattern()) {
- fullPaths.add(convertNodesToPartialPath(node, ancestors));
+ fullPaths.add((T) convertNodesToPartialPath(node, ancestors,
asMeasurementPath));
if (node.isLeaf()) {
return;
}
@@ -262,23 +283,19 @@ public class PathPatternTree {
ancestors.push(node.getName());
for (PathPatternNode<Void, VoidSerializer> child :
node.getChildren().values()) {
- searchPathPattern(child, ancestors, fullPaths);
+ searchPathPattern(child, ancestors, fullPaths, asMeasurementPath);
}
ancestors.pop();
}
- public List<PartialPath> getOverlappedPathPatterns(PartialPath pattern) {
- if (pathPatternList.isEmpty()) {
- pathPatternList = getAllPathPatterns();
+ public List<PartialPath> getOverlappedPathPatterns(final PartialPath
pattern) {
+ List<PartialPath> patternList = pathPatternList;
+ if (Objects.isNull(patternList) || patternList.isEmpty()) {
+ patternList = getAllPathPatterns();
+ pathPatternList = patternList;
}
- List<PartialPath> results = new ArrayList<>();
- for (PartialPath path : pathPatternList) {
- if (pattern.overlapWith(path)) {
- results.add(path);
- }
- }
- return results;
+ return
patternList.stream().filter(pattern::overlapWith).collect(Collectors.toList());
}
private String convertNodesToString(List<String> nodes) {
@@ -290,14 +307,20 @@ public class PathPatternTree {
}
private PartialPath convertNodesToPartialPath(
- PathPatternNode<Void, VoidSerializer> node, Deque<String> ancestors) {
+ PathPatternNode<Void, VoidSerializer> node,
+ Deque<String> ancestors,
+ boolean asMeasurementPath) {
Iterator<String> iterator = ancestors.descendingIterator();
List<String> nodeList = new ArrayList<>(ancestors.size() + 1);
while (iterator.hasNext()) {
nodeList.add(iterator.next());
}
nodeList.add(node.getName());
- return new PartialPath(nodeList.toArray(new String[0]));
+ if (asMeasurementPath) {
+ return new MeasurementPath(nodeList.toArray(new String[0]));
+ } else {
+ return new PartialPath(nodeList.toArray(new String[0]));
+ }
}
public boolean isOverlapWith(PathPatternTree patternTree) {