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 87ad502871f Rename ShardingSphereDataNodePath (#34264)
87ad502871f is described below

commit 87ad502871f4cc9898666cb1ac5f19e1d7da66a6
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Jan 6 13:10:37 2025 +0800

    Rename ShardingSphereDataNodePath (#34264)
---
 .../data/ShardingSphereDataPersistService.java     |  12 +-
 ...taNode.java => ShardingSphereDataNodePath.java} |  74 +++++------
 .../metadata/table/TableRowDataPersistService.java |  12 +-
 .../node/ShardingSphereDataNodePathTest.java       | 138 +++++++++++++++++++++
 .../persist/node/ShardingSphereDataNodeTest.java   | 138 ---------------------
 .../collect/StatisticsCollectJobWorker.java        |   4 +-
 .../global/ShardingSphereDataChangedHandler.java   |  18 +--
 7 files changed, 198 insertions(+), 198 deletions(-)

diff --git 
a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/data/ShardingSphereDataPersistService.java
 
b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/data/ShardingSphereDataPersistService.java
index f61da68b54e..ecdd0f50cb7 100644
--- 
a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/data/ShardingSphereDataPersistService.java
+++ 
b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/data/ShardingSphereDataPersistService.java
@@ -25,7 +25,7 @@ import 
org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereSchemaD
 import 
org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereStatistics;
 import 
org.apache.shardingsphere.infra.yaml.data.pojo.YamlShardingSphereRowData;
 import 
org.apache.shardingsphere.infra.yaml.data.swapper.YamlShardingSphereRowDataSwapper;
-import org.apache.shardingsphere.metadata.persist.node.ShardingSphereDataNode;
+import 
org.apache.shardingsphere.metadata.persist.node.ShardingSphereDataNodePath;
 import 
org.apache.shardingsphere.metadata.persist.service.metadata.table.TableRowDataPersistService;
 import org.apache.shardingsphere.mode.spi.PersistRepository;
 
@@ -55,7 +55,7 @@ public final class ShardingSphereDataPersistService {
      * @return ShardingSphere statistics data
      */
     public Optional<ShardingSphereStatistics> load(final 
ShardingSphereMetaData metaData) {
-        Collection<String> databaseNames = 
repository.getChildrenKeys(ShardingSphereDataNode.getShardingSphereDataNodePath());
+        Collection<String> databaseNames = 
repository.getChildrenKeys(ShardingSphereDataNodePath.getDatabasesRootPath());
         if (databaseNames.isEmpty()) {
             return Optional.empty();
         }
@@ -68,7 +68,7 @@ public final class ShardingSphereDataPersistService {
     
     private ShardingSphereDatabaseData load(final String databaseName, final 
ShardingSphereDatabase database) {
         ShardingSphereDatabaseData result = new ShardingSphereDatabaseData();
-        for (String each : 
repository.getChildrenKeys(ShardingSphereDataNode.getSchemasPath(databaseName)).stream().filter(database::containsSchema).collect(Collectors.toList()))
 {
+        for (String each : 
repository.getChildrenKeys(ShardingSphereDataNodePath.getSchemaRootPath(databaseName)).stream().filter(database::containsSchema).collect(Collectors.toList()))
 {
             result.putSchema(each, load(databaseName, each, 
database.getSchema(each)));
         }
         return result;
@@ -76,7 +76,7 @@ public final class ShardingSphereDataPersistService {
     
     private ShardingSphereSchemaData load(final String databaseName, final 
String schemaName, final ShardingSphereSchema schema) {
         ShardingSphereSchemaData result = new ShardingSphereSchemaData();
-        for (String each : 
repository.getChildrenKeys(ShardingSphereDataNode.getTablesPath(databaseName, 
schemaName)).stream().filter(schema::containsTable).collect(Collectors.toList()))
 {
+        for (String each : 
repository.getChildrenKeys(ShardingSphereDataNodePath.getTableRootPath(databaseName,
 
schemaName)).stream().filter(schema::containsTable).collect(Collectors.toList()))
 {
             result.getTableData().put(each, 
tableRowDataPersistService.load(databaseName, schemaName, each, 
schema.getTable(each)));
             
         }
@@ -98,7 +98,7 @@ public final class ShardingSphereDataPersistService {
     }
     
     private void persistSchema(final String databaseName, final String 
schemaName) {
-        
repository.persist(ShardingSphereDataNode.getSchemaDataPath(databaseName, 
schemaName), "");
+        
repository.persist(ShardingSphereDataNodePath.getSchemaDataPath(databaseName, 
schemaName), "");
     }
     
     private void persistTableData(final ShardingSphereDatabase database, final 
String schemaName, final ShardingSphereSchemaData schemaData) {
@@ -130,6 +130,6 @@ public final class ShardingSphereDataPersistService {
      * @param databaseName database name
      */
     public void delete(final String databaseName) {
-        
repository.delete(ShardingSphereDataNode.getDatabaseNamePath(databaseName));
+        
repository.delete(ShardingSphereDataNodePath.getDatabasePath(databaseName));
     }
 }
diff --git 
a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/ShardingSphereDataNode.java
 
b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/ShardingSphereDataNodePath.java
similarity index 68%
rename from 
kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/ShardingSphereDataNode.java
rename to 
kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/ShardingSphereDataNodePath.java
index 73d659533af..9389ad711f9 100644
--- 
a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/ShardingSphereDataNode.java
+++ 
b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/ShardingSphereDataNodePath.java
@@ -25,10 +25,10 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 /**
- * ShardingSphere data node.
+ * ShardingSphere data node path.
  */
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class ShardingSphereDataNode {
+public final class ShardingSphereDataNodePath {
     
     private static final String ROOT_NODE = "statistics";
     
@@ -41,33 +41,32 @@ public final class ShardingSphereDataNode {
     private static final String JOB_NODE = "job";
     
     /**
-     * Get ShardingSphere data node path.
+     * Get database root path.
      *
-     * @return meta data node path
+     * @return database root path
      */
-    public static String getShardingSphereDataNodePath() {
+    public static String getDatabasesRootPath() {
         return String.join("/", "", ROOT_NODE, DATABASES_NODE);
     }
     
     /**
-     * Get database name path.
+     * Get database path.
      *
      * @param databaseName database name
-     * @return database name path
+     * @return database path
      */
-    public static String getDatabaseNamePath(final String databaseName) {
-        return String.join("/", getShardingSphereDataNodePath(), databaseName);
+    public static String getDatabasePath(final String databaseName) {
+        return String.join("/", getDatabasesRootPath(), databaseName);
     }
     
     /**
-     * Get meta data tables path.
+     * Get schema root path.
      *
      * @param databaseName database name
-     * @param schemaName schema name
-     * @return tables path
+     * @return schema root path
      */
-    public static String getTablesPath(final String databaseName, final String 
schemaName) {
-        return String.join("/", getSchemaDataPath(databaseName, schemaName), 
TABLES_NODE);
+    public static String getSchemaRootPath(final String databaseName) {
+        return String.join("/", getDatabasePath(databaseName), SCHEMAS_NODE);
     }
     
     /**
@@ -75,32 +74,33 @@ public final class ShardingSphereDataNode {
      *
      * @param databaseName database name
      * @param schemaName schema name
-     * @return tables path
+     * @return schema path
      */
     public static String getSchemaDataPath(final String databaseName, final 
String schemaName) {
-        return String.join("/", getSchemasPath(databaseName), schemaName);
+        return String.join("/", getSchemaRootPath(databaseName), schemaName);
     }
     
     /**
-     * Get meta data schemas path.
+     * Get table root path.
      *
      * @param databaseName database name
-     * @return schemas path
+     * @param schemaName schema name
+     * @return table root path
      */
-    public static String getSchemasPath(final String databaseName) {
-        return String.join("/", getDatabaseNamePath(databaseName), 
SCHEMAS_NODE);
+    public static String getTableRootPath(final String databaseName, final 
String schemaName) {
+        return String.join("/", getSchemaDataPath(databaseName, schemaName), 
TABLES_NODE);
     }
     
     /**
-     * Get table meta data path.
+     * Get table path.
      *
      * @param databaseName database name
      * @param schemaName schema name
      * @param table table name
-     * @return table meta data path
+     * @return table path
      */
     public static String getTablePath(final String databaseName, final String 
schemaName, final String table) {
-        return String.join("/", getTablesPath(databaseName, schemaName), 
table);
+        return String.join("/", getTableRootPath(databaseName, schemaName), 
table);
     }
     
     /**
@@ -110,32 +110,32 @@ public final class ShardingSphereDataNode {
      * @param schemaName schema name
      * @param table table name
      * @param uniqueKey unique key
-     * @return table meta data path
+     * @return table row path
      */
     public static String getTableRowPath(final String databaseName, final 
String schemaName, final String table, final String uniqueKey) {
         return String.join("/", getTablePath(databaseName, schemaName, table), 
uniqueKey);
     }
     
     /**
-     * Get database name.
+     * Find database name.
      *
      * @param configNodeFullPath config node full path
-     * @return database name
+     * @return found database name
      */
-    public static Optional<String> getDatabaseName(final String 
configNodeFullPath) {
-        Pattern pattern = Pattern.compile(getShardingSphereDataNodePath() + 
"/([\\w\\-]+)$", Pattern.CASE_INSENSITIVE);
+    public static Optional<String> findDatabaseName(final String 
configNodeFullPath) {
+        Pattern pattern = Pattern.compile(getDatabasesRootPath() + 
"/([\\w\\-]+)$", Pattern.CASE_INSENSITIVE);
         Matcher matcher = pattern.matcher(configNodeFullPath);
         return matcher.find() ? Optional.of(matcher.group(1)) : 
Optional.empty();
     }
     
     /**
-     * Get schema name.
+     * Find schema name.
      *
      * @param configNodeFullPath config node full path
-     * @return schema name
+     * @return found schema name
      */
-    public static Optional<String> getSchemaName(final String 
configNodeFullPath) {
-        Pattern pattern = Pattern.compile(getShardingSphereDataNodePath() + 
"/([\\w\\-]+)/schemas/([\\w\\-]+)$", Pattern.CASE_INSENSITIVE);
+    public static Optional<String> findSchemaName(final String 
configNodeFullPath) {
+        Pattern pattern = Pattern.compile(getDatabasesRootPath() + 
"/([\\w\\-]+)/schemas/([\\w\\-]+)$", Pattern.CASE_INSENSITIVE);
         Matcher matcher = pattern.matcher(configNodeFullPath);
         return matcher.find() ? Optional.of(matcher.group(2)) : 
Optional.empty();
     }
@@ -147,7 +147,7 @@ public final class ShardingSphereDataNode {
      * @return database name
      */
     public static Optional<String> getDatabaseNameByDatabasePath(final String 
databasePath) {
-        Pattern pattern = Pattern.compile(getShardingSphereDataNodePath() + 
"/([\\w\\-]+)?", Pattern.CASE_INSENSITIVE);
+        Pattern pattern = Pattern.compile(getDatabasesRootPath() + 
"/([\\w\\-]+)?", Pattern.CASE_INSENSITIVE);
         Matcher matcher = pattern.matcher(databasePath);
         return matcher.find() ? Optional.of(matcher.group(1)) : 
Optional.empty();
     }
@@ -159,7 +159,7 @@ public final class ShardingSphereDataNode {
      * @return schema name
      */
     public static Optional<String> getSchemaNameBySchemaPath(final String 
schemaPath) {
-        Pattern pattern = Pattern.compile(getShardingSphereDataNodePath() + 
"/([\\w\\-]+)/schemas/([\\w\\-]+)?", Pattern.CASE_INSENSITIVE);
+        Pattern pattern = Pattern.compile(getDatabasesRootPath() + 
"/([\\w\\-]+)/schemas/([\\w\\-]+)?", Pattern.CASE_INSENSITIVE);
         Matcher matcher = pattern.matcher(schemaPath);
         return matcher.find() ? Optional.of(matcher.group(2)) : 
Optional.empty();
     }
@@ -171,7 +171,7 @@ public final class ShardingSphereDataNode {
      * @return table name
      */
     public static Optional<String> getTableName(final String 
tableMetaDataPath) {
-        Pattern pattern = Pattern.compile(getShardingSphereDataNodePath() + 
"/([\\w\\-]+)/schemas/([\\w\\-]+)/tables" + "/([\\w\\-]+)$", 
Pattern.CASE_INSENSITIVE);
+        Pattern pattern = Pattern.compile(getDatabasesRootPath() + 
"/([\\w\\-]+)/schemas/([\\w\\-]+)/tables" + "/([\\w\\-]+)$", 
Pattern.CASE_INSENSITIVE);
         Matcher matcher = pattern.matcher(tableMetaDataPath);
         return matcher.find() ? Optional.of(matcher.group(3)) : 
Optional.empty();
     }
@@ -183,7 +183,7 @@ public final class ShardingSphereDataNode {
      * @return table name
      */
     public static Optional<String> getTableNameByRowPath(final String rowPath) 
{
-        Pattern pattern = Pattern.compile(getShardingSphereDataNodePath() + 
"/([\\w\\-]+)/schemas/([\\w\\-]+)/tables" + "/([\\w\\-]+)?", 
Pattern.CASE_INSENSITIVE);
+        Pattern pattern = Pattern.compile(getDatabasesRootPath() + 
"/([\\w\\-]+)/schemas/([\\w\\-]+)/tables" + "/([\\w\\-]+)?", 
Pattern.CASE_INSENSITIVE);
         Matcher matcher = pattern.matcher(rowPath);
         return matcher.find() ? Optional.of(matcher.group(3)) : 
Optional.empty();
     }
@@ -195,7 +195,7 @@ public final class ShardingSphereDataNode {
      * @return row unique key
      */
     public static Optional<String> getRowUniqueKey(final String rowPath) {
-        Pattern pattern = Pattern.compile(getShardingSphereDataNodePath() + 
"/([\\w\\-]+)/schemas/([\\w\\-]+)/tables" + "/([\\w\\-]+)" + "/(\\w+)$", 
Pattern.CASE_INSENSITIVE);
+        Pattern pattern = Pattern.compile(getDatabasesRootPath() + 
"/([\\w\\-]+)/schemas/([\\w\\-]+)/tables" + "/([\\w\\-]+)" + "/(\\w+)$", 
Pattern.CASE_INSENSITIVE);
         Matcher matcher = pattern.matcher(rowPath);
         return matcher.find() ? Optional.of(matcher.group(4)) : 
Optional.empty();
     }
diff --git 
a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/metadata/table/TableRowDataPersistService.java
 
b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/metadata/table/TableRowDataPersistService.java
index 71380e1d7d5..c0ad425c54b 100644
--- 
a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/metadata/table/TableRowDataPersistService.java
+++ 
b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/metadata/table/TableRowDataPersistService.java
@@ -24,7 +24,7 @@ import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSp
 import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
 import 
org.apache.shardingsphere.infra.yaml.data.pojo.YamlShardingSphereRowData;
 import 
org.apache.shardingsphere.infra.yaml.data.swapper.YamlShardingSphereRowDataSwapper;
-import org.apache.shardingsphere.metadata.persist.node.ShardingSphereDataNode;
+import 
org.apache.shardingsphere.metadata.persist.node.ShardingSphereDataNodePath;
 import org.apache.shardingsphere.mode.spi.PersistRepository;
 
 import java.util.ArrayList;
@@ -48,9 +48,9 @@ public final class TableRowDataPersistService {
      */
     public void persist(final String databaseName, final String schemaName, 
final String tableName, final Collection<YamlShardingSphereRowData> rows) {
         if (rows.isEmpty()) {
-            
repository.persist(ShardingSphereDataNode.getTablePath(databaseName, 
schemaName, tableName.toLowerCase()), "");
+            
repository.persist(ShardingSphereDataNodePath.getTablePath(databaseName, 
schemaName, tableName.toLowerCase()), "");
         } else {
-            rows.forEach(each -> 
repository.persist(ShardingSphereDataNode.getTableRowPath(databaseName, 
schemaName, tableName.toLowerCase(), each.getUniqueKey()), 
YamlEngine.marshal(each)));
+            rows.forEach(each -> 
repository.persist(ShardingSphereDataNodePath.getTableRowPath(databaseName, 
schemaName, tableName.toLowerCase(), each.getUniqueKey()), 
YamlEngine.marshal(each)));
         }
     }
     
@@ -63,7 +63,7 @@ public final class TableRowDataPersistService {
      * @param rows rows
      */
     public void delete(final String databaseName, final String schemaName, 
final String tableName, final Collection<YamlShardingSphereRowData> rows) {
-        rows.forEach(each -> 
repository.delete(ShardingSphereDataNode.getTableRowPath(databaseName, 
schemaName, tableName.toLowerCase(), each.getUniqueKey())));
+        rows.forEach(each -> 
repository.delete(ShardingSphereDataNodePath.getTableRowPath(databaseName, 
schemaName, tableName.toLowerCase(), each.getUniqueKey())));
     }
     
     /**
@@ -78,8 +78,8 @@ public final class TableRowDataPersistService {
     public ShardingSphereTableData load(final String databaseName, final 
String schemaName, final String tableName, final ShardingSphereTable table) {
         ShardingSphereTableData result = new 
ShardingSphereTableData(tableName);
         YamlShardingSphereRowDataSwapper swapper = new 
YamlShardingSphereRowDataSwapper(new ArrayList<>(table.getAllColumns()));
-        for (String each : 
repository.getChildrenKeys(ShardingSphereDataNode.getTablePath(databaseName, 
schemaName, tableName))) {
-            String yamlRow = 
repository.query(ShardingSphereDataNode.getTableRowPath(databaseName, 
schemaName, tableName, each));
+        for (String each : 
repository.getChildrenKeys(ShardingSphereDataNodePath.getTablePath(databaseName,
 schemaName, tableName))) {
+            String yamlRow = 
repository.query(ShardingSphereDataNodePath.getTableRowPath(databaseName, 
schemaName, tableName, each));
             if (!Strings.isNullOrEmpty(yamlRow)) {
                 
result.getRows().add(swapper.swapToObject(YamlEngine.unmarshal(yamlRow, 
YamlShardingSphereRowData.class)));
             }
diff --git 
a/kernel/metadata/core/src/test/java/org/apache/shardingsphere/metadata/persist/node/ShardingSphereDataNodePathTest.java
 
b/kernel/metadata/core/src/test/java/org/apache/shardingsphere/metadata/persist/node/ShardingSphereDataNodePathTest.java
new file mode 100644
index 00000000000..626a486e14d
--- /dev/null
+++ 
b/kernel/metadata/core/src/test/java/org/apache/shardingsphere/metadata/persist/node/ShardingSphereDataNodePathTest.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.metadata.persist.node;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Optional;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class ShardingSphereDataNodePathTest {
+    
+    @Test
+    void assertGetDatabasesRootPath() {
+        assertThat(ShardingSphereDataNodePath.getDatabasesRootPath(), 
is("/statistics/databases"));
+    }
+    
+    @Test
+    void assertGetDatabasePath() {
+        assertThat(ShardingSphereDataNodePath.getDatabasePath("foo_db"), 
is("/statistics/databases/foo_db"));
+    }
+    
+    @Test
+    void assertGetSchemaRootPath() {
+        assertThat(ShardingSphereDataNodePath.getSchemaRootPath("foo_db"), 
is("/statistics/databases/foo_db/schemas"));
+    }
+    
+    @Test
+    void assertGetSchemaDataPath() {
+        assertThat(ShardingSphereDataNodePath.getSchemaDataPath("foo_db", 
"db_schema"), is("/statistics/databases/foo_db/schemas/db_schema"));
+    }
+    
+    @Test
+    void assertGetTableRootPath() {
+        assertThat(ShardingSphereDataNodePath.getTableRootPath("foo_db", 
"db_schema"), is("/statistics/databases/foo_db/schemas/db_schema/tables"));
+    }
+    
+    @Test
+    void assertGetTablePath() {
+        assertThat(ShardingSphereDataNodePath.getTablePath("foo_db", 
"db_schema", "tbl_name"), 
is("/statistics/databases/foo_db/schemas/db_schema/tables/tbl_name"));
+    }
+    
+    @Test
+    void assertGetTableRowPath() {
+        assertThat(ShardingSphereDataNodePath.getTableRowPath("foo_db", 
"db_schema", "tbl_name", "key"), 
is("/statistics/databases/foo_db/schemas/db_schema/tables/tbl_name/key"));
+    }
+    
+    @Test
+    void assertFindDatabaseNameHappyPath() {
+        
assertThat(ShardingSphereDataNodePath.findDatabaseName("/statistics/databases/foo_db"),
 is(Optional.of("foo_db")));
+    }
+    
+    @Test
+    void assertFindDatabaseNameDbNameNotFoundScenario() {
+        
assertThat(ShardingSphereDataNodePath.findDatabaseName("/statistics/databases"),
 is(Optional.empty()));
+    }
+    
+    @Test
+    void assertFindSchemaNameHappyPath() {
+        
assertThat(ShardingSphereDataNodePath.findSchemaName("/statistics/databases/foo_db/schemas/db_schema"),
 is(Optional.of("db_schema")));
+    }
+    
+    @Test
+    void assertFindSchemaNameSchemaNameNotFoundScenario() {
+        
assertThat(ShardingSphereDataNodePath.findSchemaName("/statistics/databases/foo_db"),
 is(Optional.empty()));
+    }
+    
+    @Test
+    void assertFindDatabaseNameByDatabasePathHappyPath() {
+        
assertThat(ShardingSphereDataNodePath.getDatabaseNameByDatabasePath("/statistics/databases/foo_db"),
 is(Optional.of("foo_db")));
+    }
+    
+    @Test
+    void assertFindDatabaseNameByDatabasePathDbNameNotFoundScenario() {
+        
assertThat(ShardingSphereDataNodePath.getDatabaseNameByDatabasePath("/statistics/databases"),
 is(Optional.empty()));
+    }
+    
+    @Test
+    void assertFindSchemaNameBySchemaPathHappyPath() {
+        
assertThat(ShardingSphereDataNodePath.getSchemaNameBySchemaPath("/statistics/databases/foo_db/schemas/db_schema"),
 is(Optional.of("db_schema")));
+    }
+    
+    @Test
+    void assertFindSchemaNameBySchemaPathSchemaNameNotFoundScenario() {
+        
assertThat(ShardingSphereDataNodePath.getSchemaNameBySchemaPath("/statistics//databasesdb_name"),
 is(Optional.empty()));
+    }
+    
+    @Test
+    void assertGetTableNameHappyPath() {
+        
assertThat(ShardingSphereDataNodePath.getTableName("/statistics/databases/foo_db/schemas/db_schema/tables/tbl_name"),
 is(Optional.of("tbl_name")));
+    }
+    
+    @Test
+    void assertGetTableNameTableNameNotFoundScenario() {
+        
assertThat(ShardingSphereDataNodePath.getTableName("/statistics/databases/foo_db/schemas/db_schema"),
 is(Optional.empty()));
+    }
+    
+    @Test
+    void assertGetTableNameByRowPathHappyPath() {
+        
assertThat(ShardingSphereDataNodePath.getTableNameByRowPath("/statistics/databases/foo_db/schemas/db_schema/tables/tbl_name"),
 is(Optional.of("tbl_name")));
+    }
+    
+    @Test
+    void assertGetTableNameByRowPathTableNameNotFoundScenario() {
+        
assertThat(ShardingSphereDataNodePath.getTableNameByRowPath("/statistics/databases/foo_db/schemas/db_schema"),
 is(Optional.empty()));
+    }
+    
+    @Test
+    void assertGetRowUniqueKeyHappyPath() {
+        
assertThat(ShardingSphereDataNodePath.getRowUniqueKey("/statistics/databases/foo_db/schemas/db_schema/tables/tbl_name/key"),
 is(Optional.of("key")));
+    }
+    
+    @Test
+    void assertGetRowUniqueKeyUniqueKeyNotFoundScenario() {
+        
assertThat(ShardingSphereDataNodePath.getRowUniqueKey("/statistics/databases/foo_db/schemas/db_schema/tables/tbl_name"),
 is(Optional.empty()));
+    }
+    
+    @Test
+    void assertGetJobPath() {
+        assertThat(ShardingSphereDataNodePath.getJobPath(), 
is("statistics/job"));
+    }
+}
diff --git 
a/kernel/metadata/core/src/test/java/org/apache/shardingsphere/metadata/persist/node/ShardingSphereDataNodeTest.java
 
b/kernel/metadata/core/src/test/java/org/apache/shardingsphere/metadata/persist/node/ShardingSphereDataNodeTest.java
deleted file mode 100644
index 4d25421694a..00000000000
--- 
a/kernel/metadata/core/src/test/java/org/apache/shardingsphere/metadata/persist/node/ShardingSphereDataNodeTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.metadata.persist.node;
-
-import org.junit.jupiter.api.Test;
-
-import java.util.Optional;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-class ShardingSphereDataNodeTest {
-    
-    @Test
-    void assertGetShardingSphereDataNodePath() {
-        assertThat(ShardingSphereDataNode.getShardingSphereDataNodePath(), 
is("/statistics/databases"));
-    }
-    
-    @Test
-    void assertGetDatabaseNamePath() {
-        assertThat(ShardingSphereDataNode.getDatabaseNamePath("db_path"), 
is("/statistics/databases/db_path"));
-    }
-    
-    @Test
-    void assertGetTablesPath() {
-        assertThat(ShardingSphereDataNode.getTablesPath("db_name", 
"db_schema"), is("/statistics/databases/db_name/schemas/db_schema/tables"));
-    }
-    
-    @Test
-    void assertGetSchemaDataPath() {
-        assertThat(ShardingSphereDataNode.getSchemaDataPath("db_name", 
"db_schema"), is("/statistics/databases/db_name/schemas/db_schema"));
-    }
-    
-    @Test
-    void assertGetSchemasPath() {
-        assertThat(ShardingSphereDataNode.getSchemasPath("db_name"), 
is("/statistics/databases/db_name/schemas"));
-    }
-    
-    @Test
-    void assertGetTablePath() {
-        assertThat(ShardingSphereDataNode.getTablePath("db_name", "db_schema", 
"tbl_name"), 
is("/statistics/databases/db_name/schemas/db_schema/tables/tbl_name"));
-    }
-    
-    @Test
-    void assertGetTableRowPath() {
-        assertThat(ShardingSphereDataNode.getTableRowPath("db_name", 
"db_schema", "tbl_name", "key"), 
is("/statistics/databases/db_name/schemas/db_schema/tables/tbl_name/key"));
-    }
-    
-    @Test
-    void assertGetDatabaseNameHappyPath() {
-        
assertThat(ShardingSphereDataNode.getDatabaseName("/statistics/databases/db_name"),
 is(Optional.of("db_name")));
-    }
-    
-    @Test
-    void assertGetDatabaseNameDbNameNotFoundScenario() {
-        
assertThat(ShardingSphereDataNode.getDatabaseName("/statistics/databases"), 
is(Optional.empty()));
-    }
-    
-    @Test
-    void assertGetSchemaNameHappyPath() {
-        
assertThat(ShardingSphereDataNode.getSchemaName("/statistics/databases/db_name/schemas/db_schema"),
 is(Optional.of("db_schema")));
-    }
-    
-    @Test
-    void assertGetSchemaNameSchemaNameNotFoundScenario() {
-        
assertThat(ShardingSphereDataNode.getSchemaName("/statistics/databases/db_name"),
 is(Optional.empty()));
-    }
-    
-    @Test
-    void assertGetDatabaseNameByDatabasePathHappyPath() {
-        
assertThat(ShardingSphereDataNode.getDatabaseNameByDatabasePath("/statistics/databases/db_name"),
 is(Optional.of("db_name")));
-    }
-    
-    @Test
-    void assertGetDatabaseNameByDatabasePathDbNameNotFoundScenario() {
-        
assertThat(ShardingSphereDataNode.getDatabaseNameByDatabasePath("/statistics/databases"),
 is(Optional.empty()));
-    }
-    
-    @Test
-    void assertGetSchemaNameBySchemaPathHappyPath() {
-        
assertThat(ShardingSphereDataNode.getSchemaNameBySchemaPath("/statistics/databases/db_name/schemas/db_schema"),
 is(Optional.of("db_schema")));
-    }
-    
-    @Test
-    void assertGetSchemaNameBySchemaPathSchemaNameNotFoundScenario() {
-        
assertThat(ShardingSphereDataNode.getSchemaNameBySchemaPath("/statistics//databasesdb_name"),
 is(Optional.empty()));
-    }
-    
-    @Test
-    void assertGetTableNameHappyPath() {
-        
assertThat(ShardingSphereDataNode.getTableName("/statistics/databases/db_name/schemas/db_schema/tables/tbl_name"),
 is(Optional.of("tbl_name")));
-    }
-    
-    @Test
-    void assertGetTableNameTableNameNotFoundScenario() {
-        
assertThat(ShardingSphereDataNode.getTableName("/statistics/databases/db_name/schemas/db_schema"),
 is(Optional.empty()));
-    }
-    
-    @Test
-    void assertGetTableNameByRowPathHappyPath() {
-        
assertThat(ShardingSphereDataNode.getTableNameByRowPath("/statistics/databases/db_name/schemas/db_schema/tables/tbl_name"),
 is(Optional.of("tbl_name")));
-    }
-    
-    @Test
-    void assertGetTableNameByRowPathTableNameNotFoundScenario() {
-        
assertThat(ShardingSphereDataNode.getTableNameByRowPath("/statistics/databases/db_name/schemas/db_schema"),
 is(Optional.empty()));
-    }
-    
-    @Test
-    void assertGetRowUniqueKeyHappyPath() {
-        
assertThat(ShardingSphereDataNode.getRowUniqueKey("/statistics/databases/db_name/schemas/db_schema/tables/tbl_name/key"),
 is(Optional.of("key")));
-    }
-    
-    @Test
-    void assertGetRowUniqueKeyUniqueKeyNotFoundScenario() {
-        
assertThat(ShardingSphereDataNode.getRowUniqueKey("/statistics/databases/db_name/schemas/db_schema/tables/tbl_name"),
 is(Optional.empty()));
-    }
-    
-    @Test
-    void assertGetJobPath() {
-        assertThat(ShardingSphereDataNode.getJobPath(), is("statistics/job"));
-    }
-}
diff --git 
a/kernel/schedule/core/src/main/java/org/apache/shardingsphere/schedule/core/job/statistics/collect/StatisticsCollectJobWorker.java
 
b/kernel/schedule/core/src/main/java/org/apache/shardingsphere/schedule/core/job/statistics/collect/StatisticsCollectJobWorker.java
index b84a776ebde..fa9537cc306 100644
--- 
a/kernel/schedule/core/src/main/java/org/apache/shardingsphere/schedule/core/job/statistics/collect/StatisticsCollectJobWorker.java
+++ 
b/kernel/schedule/core/src/main/java/org/apache/shardingsphere/schedule/core/job/statistics/collect/StatisticsCollectJobWorker.java
@@ -25,7 +25,7 @@ import 
org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter;
 import 
org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperConfiguration;
 import 
org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperRegistryCenter;
 import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
-import org.apache.shardingsphere.metadata.persist.node.ShardingSphereDataNode;
+import 
org.apache.shardingsphere.metadata.persist.node.ShardingSphereDataNodePath;
 import org.apache.shardingsphere.mode.manager.ContextManager;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryConfiguration;
 
@@ -68,7 +68,7 @@ public final class StatisticsCollectJobWorker {
     
     private CoordinatorRegistryCenter createRegistryCenter(final 
ModeConfiguration modeConfig) {
         ClusterPersistRepositoryConfiguration repositoryConfig = 
(ClusterPersistRepositoryConfiguration) modeConfig.getRepository();
-        String namespace = String.join("/", repositoryConfig.getNamespace(), 
ShardingSphereDataNode.getJobPath());
+        String namespace = String.join("/", repositoryConfig.getNamespace(), 
ShardingSphereDataNodePath.getJobPath());
         CoordinatorRegistryCenter result = new 
ZookeeperRegistryCenter(getZookeeperConfiguration(repositoryConfig, namespace));
         result.init();
         return result;
diff --git 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/ShardingSphereDataChangedHandler.java
 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/ShardingSphereDataChangedHandler.java
index 354105a811f..b1eff4454a0 100644
--- 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/ShardingSphereDataChangedHandler.java
+++ 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/ShardingSphereDataChangedHandler.java
@@ -20,7 +20,7 @@ package 
org.apache.shardingsphere.mode.manager.cluster.dispatch.handler.global;
 import com.google.common.base.Strings;
 import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
 import 
org.apache.shardingsphere.infra.yaml.data.pojo.YamlShardingSphereRowData;
-import org.apache.shardingsphere.metadata.persist.node.ShardingSphereDataNode;
+import 
org.apache.shardingsphere.metadata.persist.node.ShardingSphereDataNodePath;
 import org.apache.shardingsphere.mode.event.DataChangedEvent;
 import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
 import org.apache.shardingsphere.mode.manager.ContextManager;
@@ -38,7 +38,7 @@ public final class ShardingSphereDataChangedHandler 
implements DataChangedEventH
     
     @Override
     public String getSubscribedKey() {
-        return ShardingSphereDataNode.getShardingSphereDataNodePath();
+        return ShardingSphereDataNodePath.getDatabasesRootPath();
     }
     
     @Override
@@ -49,34 +49,34 @@ public final class ShardingSphereDataChangedHandler 
implements DataChangedEventH
     @Override
     public void handle(final ContextManager contextManager, final 
DataChangedEvent event) {
         ShardingSphereDatabaseDataManager databaseManager = 
contextManager.getMetaDataContextManager().getDatabaseManager();
-        Optional<String> databaseName = 
ShardingSphereDataNode.getDatabaseName(event.getKey());
+        Optional<String> databaseName = 
ShardingSphereDataNodePath.findDatabaseName(event.getKey());
         if (databaseName.isPresent()) {
             handleDatabaseChanged(databaseManager, event.getType(), 
databaseName.get());
             return;
         }
-        databaseName = 
ShardingSphereDataNode.getDatabaseNameByDatabasePath(event.getKey());
+        databaseName = 
ShardingSphereDataNodePath.getDatabaseNameByDatabasePath(event.getKey());
         if (!databaseName.isPresent()) {
             return;
         }
-        Optional<String> schemaName = 
ShardingSphereDataNode.getSchemaName(event.getKey());
+        Optional<String> schemaName = 
ShardingSphereDataNodePath.findSchemaName(event.getKey());
         if (schemaName.isPresent()) {
             handleSchemaChanged(databaseManager, event.getType(), 
databaseName.get(), schemaName.get());
             return;
         }
-        schemaName = 
ShardingSphereDataNode.getSchemaNameBySchemaPath(event.getKey());
+        schemaName = 
ShardingSphereDataNodePath.getSchemaNameBySchemaPath(event.getKey());
         if (!schemaName.isPresent()) {
             return;
         }
-        Optional<String> tableName = 
ShardingSphereDataNode.getTableName(event.getKey());
+        Optional<String> tableName = 
ShardingSphereDataNodePath.getTableName(event.getKey());
         if (tableName.isPresent()) {
             handleTableChanged(databaseManager, event.getType(), 
databaseName.get(), schemaName.get(), tableName.get());
             return;
         }
-        tableName = 
ShardingSphereDataNode.getTableNameByRowPath(event.getKey());
+        tableName = 
ShardingSphereDataNodePath.getTableNameByRowPath(event.getKey());
         if (!tableName.isPresent()) {
             return;
         }
-        Optional<String> rowPath = 
ShardingSphereDataNode.getRowUniqueKey(event.getKey());
+        Optional<String> rowPath = 
ShardingSphereDataNodePath.getRowUniqueKey(event.getKey());
         if (rowPath.isPresent()) {
             handleRowDataChanged(databaseManager, event.getType(), 
event.getValue(), databaseName.get(), schemaName.get(), tableName.get(), 
rowPath.get());
         }


Reply via email to