You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by me...@apache.org on 2025/02/26 06:17:14 UTC
(shardingsphere) branch master updated: Refactor RuleItemAlteredBuildExecutor (#34793)
This is an automated email from the ASF dual-hosted git repository.
menghaoran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 280c32a5e7f Refactor RuleItemAlteredBuildExecutor (#34793)
280c32a5e7f is described below
commit 280c32a5e7f4c939842bab8f2fc49a025dbb9268
Author: Haoran Meng <me...@gmail.com>
AuthorDate: Wed Feb 26 14:17:09 2025 +0800
Refactor RuleItemAlteredBuildExecutor (#34793)
---
.../metadata/changed/executor/type/RuleItemAlteredBuildExecutor.java | 3 ++-
.../shardingsphere/mode/node/path/engine/searcher/NodePathPattern.java | 2 +-
.../mode/node/path/engine/searcher/NodePathPatternTest.java | 1 +
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/changed/executor/type/RuleItemAlteredBuildExecutor.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/changed/executor/type/RuleItemAlteredBuildExecutor.java
index 6d842b8e9a3..88c21e12e45 100644
--- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/changed/executor/type/RuleItemAlteredBuildExecutor.java
+++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/changed/executor/type/RuleItemAlteredBuildExecutor.java
@@ -37,7 +37,8 @@ public final class RuleItemAlteredBuildExecutor implements RuleItemChangedBuildE
@Override
public Optional<AlterRuleItem> build(final DatabaseRuleNode databaseRuleNode, final String databaseName, final String path, final Integer activeVersion) {
for (String each : databaseRuleNode.getNamedItems()) {
- DatabaseRuleNodePath databaseRuleNodePath = new DatabaseRuleNodePath(NodePathPattern.IDENTIFIER, databaseRuleNode.getRuleType(), new DatabaseRuleItem(each, NodePathPattern.IDENTIFIER));
+ DatabaseRuleNodePath databaseRuleNodePath = new DatabaseRuleNodePath(NodePathPattern.IDENTIFIER, databaseRuleNode.getRuleType(),
+ new DatabaseRuleItem(each, NodePathPattern.QUALIFIED_IDENTIFIER));
Optional<String> itemName = new VersionNodePathParser(databaseRuleNodePath).findIdentifierByActiveVersionPath(path, 2);
if (itemName.isPresent()) {
return Optional.of(new AlterNamedRuleItem(databaseName, itemName.get(), path, activeVersion, databaseRuleNode.getRuleType() + "." + each));
diff --git a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/engine/searcher/NodePathPattern.java b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/engine/searcher/NodePathPattern.java
index 570346f3e3e..6d0ee663e48 100644
--- a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/engine/searcher/NodePathPattern.java
+++ b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/engine/searcher/NodePathPattern.java
@@ -34,5 +34,5 @@ public final class NodePathPattern {
/**
* Qualified identifier pattern.
*/
- public static final String QUALIFIED_IDENTIFIER = "([\\w-.]+)";
+ public static final String QUALIFIED_IDENTIFIER = "([\\w-]+(?:[:.][\\w-]+)*)";
}
diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/engine/searcher/NodePathPatternTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/engine/searcher/NodePathPatternTest.java
index 515ec6b9bc9..01c2bf0df37 100644
--- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/engine/searcher/NodePathPatternTest.java
+++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/engine/searcher/NodePathPatternTest.java
@@ -46,5 +46,6 @@ class NodePathPatternTest {
assertTrue(pattern.matcher("foo-bar").matches());
assertTrue(pattern.matcher("foo.bar").matches());
assertFalse(pattern.matcher("#foo").matches());
+ assertTrue(pattern.matcher("foo:foo_bar").matches());
}
}