You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2025/03/01 15:38:53 UTC
(shardingsphere) branch master updated: Remove useless VersionNodePath.getOriginalPath() (#34834)
This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 35648dfc713 Remove useless VersionNodePath.getOriginalPath() (#34834)
35648dfc713 is described below
commit 35648dfc7133304ca1c781c52a7c2a212963c166
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat Mar 1 23:38:47 2025 +0800
Remove useless VersionNodePath.getOriginalPath() (#34834)
---
.../persist/config/database/DatabaseRulePersistService.java | 4 ++--
.../mode/node/path/type/version/VersionNodePath.java | 10 ----------
.../mode/node/path/type/version/VersionNodePathTest.java | 5 -----
3 files changed, 2 insertions(+), 17 deletions(-)
diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/config/database/DatabaseRulePersistService.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/config/database/DatabaseRulePersistService.java
index 5d2f2e40ea0..4cf5c344a8a 100644
--- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/config/database/DatabaseRulePersistService.java
+++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/config/database/DatabaseRulePersistService.java
@@ -80,8 +80,8 @@ public final class DatabaseRulePersistService {
Collection<DatabaseRuleNodePath> nodePaths = new LinkedList<>();
nodePaths.addAll(getUniqueItemNodePaths(databaseName, databaseRuleNode.getRuleType(), databaseRuleNode.getUniqueItems()));
nodePaths.addAll(getNamedItemNodePaths(databaseName, databaseRuleNode.getRuleType(), databaseRuleNode.getNamedItems()));
- return nodePaths.stream().map(VersionNodePath::new)
- .map(each -> new RuleRepositoryTuple(VersionNodePath.getOriginalPath(each.getActiveVersionPath()), versionPersistService.loadContent(each))).filter(Objects::nonNull)
+ return nodePaths.stream()
+ .map(each -> new RuleRepositoryTuple(NodePathGenerator.toPath(each, false), versionPersistService.loadContent(new VersionNodePath(each)))).filter(Objects::nonNull)
.collect(Collectors.toList());
}
diff --git a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/type/version/VersionNodePath.java b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/type/version/VersionNodePath.java
index 586a4859cbf..3f4f647281e 100644
--- a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/type/version/VersionNodePath.java
+++ b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/type/version/VersionNodePath.java
@@ -63,16 +63,6 @@ public final class VersionNodePath {
return String.join("/", getVersionsPath(), String.valueOf(version));
}
- /**
- * Get original path.
- *
- * @param activeVersionPath active version path
- * @return original path
- */
- public static String getOriginalPath(final String activeVersionPath) {
- return activeVersionPath.substring(0, activeVersionPath.lastIndexOf(ACTIVE_VERSION) - 1);
- }
-
/**
* Is active version path.
*
diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/version/VersionNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/version/VersionNodePathTest.java
index 0a18d9c07d2..afdd34c75e4 100644
--- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/version/VersionNodePathTest.java
+++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/version/VersionNodePathTest.java
@@ -42,11 +42,6 @@ class VersionNodePathTest {
assertThat(new VersionNodePath(new TableMetadataNodePath("foo_db", "foo_schema", "foo_tbl")).getVersionPath(0), is("/metadata/foo_db/schemas/foo_schema/tables/foo_tbl/versions/0"));
}
- @Test
- void assertGetOriginalPath() {
- assertThat(VersionNodePath.getOriginalPath("foo_rule/active_version"), is("foo_rule"));
- }
-
@Test
void assertIsActiveVersionPath() {
assertTrue(VersionNodePath.isActiveVersionPath("foo/active_version"));