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 9948a73ba4c Refactor StatisticsNodePath (#34558)
9948a73ba4c is described below

commit 9948a73ba4c0f71112c2d42c1fc9c60277a0123e
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Feb 5 14:07:40 2025 +0800

    Refactor StatisticsNodePath (#34558)
---
 .../collect/StatisticsCollectJobWorker.java        |   4 +-
 .../service/TableRowDataPersistService.java        |  12 +--
 .../statistics/StatisticsPersistService.java       |  12 +--
 ...isticsNodePath.java => StatisticsNodePath.java} |   4 +-
 .../path/ShardingSphereStatisticsNodePathTest.java | 114 ---------------------
 .../mode/node/path/StatisticsNodePathTest.java     | 114 +++++++++++++++++++++
 .../global/type/StatisticsChangedHandler.java      |  18 ++--
 7 files changed, 139 insertions(+), 139 deletions(-)

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 9da01a46f8e..4c95a6935dd 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.mode.node.path.metadata.ShardingSphereStatisticsNodePath;
+import org.apache.shardingsphere.mode.node.path.metadata.StatisticsNodePath;
 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 = repositoryConfig.getNamespace() + 
ShardingSphereStatisticsNodePath.getJobPath();
+        String namespace = repositoryConfig.getNamespace() + 
StatisticsNodePath.getJobPath();
         CoordinatorRegistryCenter result = new 
ZookeeperRegistryCenter(getZookeeperConfiguration(repositoryConfig, namespace));
         result.init();
         return result;
diff --git 
a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/TableRowDataPersistService.java
 
b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/TableRowDataPersistService.java
index 75e832c6ca1..a0dec8575a9 100644
--- 
a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/TableRowDataPersistService.java
+++ 
b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/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.YamlRowStatistics;
 import 
org.apache.shardingsphere.infra.yaml.data.swapper.YamlRowStatisticsSwapper;
-import 
org.apache.shardingsphere.mode.node.path.metadata.ShardingSphereStatisticsNodePath;
+import org.apache.shardingsphere.mode.node.path.metadata.StatisticsNodePath;
 import org.apache.shardingsphere.mode.spi.repository.PersistRepository;
 
 import java.util.ArrayList;
@@ -48,10 +48,10 @@ public final class TableRowDataPersistService {
      */
     public void persist(final String databaseName, final String schemaName, 
final String tableName, final Collection<YamlRowStatistics> rows) {
         if (rows.isEmpty()) {
-            
repository.persist(ShardingSphereStatisticsNodePath.getTablePath(databaseName, 
schemaName, tableName.toLowerCase()), "");
+            repository.persist(StatisticsNodePath.getTablePath(databaseName, 
schemaName, tableName.toLowerCase()), "");
         } else {
             rows.forEach(
-                    each -> 
repository.persist(ShardingSphereStatisticsNodePath.getTableRowPath(databaseName,
 schemaName, tableName.toLowerCase(), each.getUniqueKey()), 
YamlEngine.marshal(each)));
+                    each -> 
repository.persist(StatisticsNodePath.getTableRowPath(databaseName, schemaName, 
tableName.toLowerCase(), each.getUniqueKey()), YamlEngine.marshal(each)));
         }
     }
     
@@ -64,7 +64,7 @@ public final class TableRowDataPersistService {
      * @param rows rows
      */
     public void delete(final String databaseName, final String schemaName, 
final String tableName, final Collection<YamlRowStatistics> rows) {
-        rows.forEach(each -> 
repository.delete(ShardingSphereStatisticsNodePath.getTableRowPath(databaseName,
 schemaName, tableName.toLowerCase(), each.getUniqueKey())));
+        rows.forEach(each -> 
repository.delete(StatisticsNodePath.getTableRowPath(databaseName, schemaName, 
tableName.toLowerCase(), each.getUniqueKey())));
     }
     
     /**
@@ -78,8 +78,8 @@ public final class TableRowDataPersistService {
     public TableStatistics load(final String databaseName, final String 
schemaName, final ShardingSphereTable table) {
         TableStatistics result = new TableStatistics(table.getName());
         YamlRowStatisticsSwapper swapper = new YamlRowStatisticsSwapper(new 
ArrayList<>(table.getAllColumns()));
-        for (String each : 
repository.getChildrenKeys(ShardingSphereStatisticsNodePath.getTablePath(databaseName,
 schemaName, table.getName()))) {
-            String yamlRow = 
repository.query(ShardingSphereStatisticsNodePath.getTableRowPath(databaseName, 
schemaName, table.getName(), each));
+        for (String each : 
repository.getChildrenKeys(StatisticsNodePath.getTablePath(databaseName, 
schemaName, table.getName()))) {
+            String yamlRow = 
repository.query(StatisticsNodePath.getTableRowPath(databaseName, schemaName, 
table.getName(), each));
             if (!Strings.isNullOrEmpty(yamlRow)) {
                 
result.getRows().add(swapper.swapToObject(YamlEngine.unmarshal(yamlRow, 
YamlRowStatistics.class)));
             }
diff --git 
a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/statistics/StatisticsPersistService.java
 
b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/statistics/StatisticsPersistService.java
index 156aa4d381f..0b030154502 100644
--- 
a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/statistics/StatisticsPersistService.java
+++ 
b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/statistics/StatisticsPersistService.java
@@ -26,7 +26,7 @@ import 
org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereStatist
 import org.apache.shardingsphere.infra.yaml.data.pojo.YamlRowStatistics;
 import 
org.apache.shardingsphere.infra.yaml.data.swapper.YamlRowStatisticsSwapper;
 import 
org.apache.shardingsphere.mode.metadata.persist.metadata.service.TableRowDataPersistService;
-import 
org.apache.shardingsphere.mode.node.path.metadata.ShardingSphereStatisticsNodePath;
+import org.apache.shardingsphere.mode.node.path.metadata.StatisticsNodePath;
 import org.apache.shardingsphere.mode.spi.repository.PersistRepository;
 
 import java.util.ArrayList;
@@ -54,7 +54,7 @@ public final class StatisticsPersistService {
      * @return statistics
      */
     public ShardingSphereStatistics load(final ShardingSphereMetaData 
metaData) {
-        Collection<String> databaseNames = 
repository.getChildrenKeys(ShardingSphereStatisticsNodePath.getDatabasesRootPath());
+        Collection<String> databaseNames = 
repository.getChildrenKeys(StatisticsNodePath.getDatabasesRootPath());
         if (databaseNames.isEmpty()) {
             return new ShardingSphereStatistics();
         }
@@ -67,7 +67,7 @@ public final class StatisticsPersistService {
     
     private DatabaseStatistics load(final ShardingSphereDatabase database) {
         DatabaseStatistics result = new DatabaseStatistics();
-        for (String each : 
repository.getChildrenKeys(ShardingSphereStatisticsNodePath.getSchemaRootPath(database.getName())).stream().filter(database::containsSchema).collect(Collectors.toList()))
 {
+        for (String each : 
repository.getChildrenKeys(StatisticsNodePath.getSchemaRootPath(database.getName())).stream().filter(database::containsSchema).collect(Collectors.toList()))
 {
             result.putSchemaStatistics(each, load(database.getName(), 
database.getSchema(each)));
         }
         return result;
@@ -75,7 +75,7 @@ public final class StatisticsPersistService {
     
     private SchemaStatistics load(final String databaseName, final 
ShardingSphereSchema schema) {
         SchemaStatistics result = new SchemaStatistics();
-        for (String each : 
repository.getChildrenKeys(ShardingSphereStatisticsNodePath.getTableRootPath(databaseName,
 schema.getName())).stream().filter(schema::containsTable)
+        for (String each : 
repository.getChildrenKeys(StatisticsNodePath.getTableRootPath(databaseName, 
schema.getName())).stream().filter(schema::containsTable)
                 .collect(Collectors.toList())) {
             result.putTableStatistics(each, 
tableRowDataPersistService.load(databaseName, schema.getName(), 
schema.getTable(each)));
             
@@ -98,7 +98,7 @@ public final class StatisticsPersistService {
     }
     
     private void persistSchema(final String databaseName, final String 
schemaName) {
-        
repository.persist(ShardingSphereStatisticsNodePath.getSchemaPath(databaseName, 
schemaName), "");
+        repository.persist(StatisticsNodePath.getSchemaPath(databaseName, 
schemaName), "");
     }
     
     private void persistTableData(final ShardingSphereDatabase database, final 
String schemaName, final SchemaStatistics schemaStatistics) {
@@ -133,6 +133,6 @@ public final class StatisticsPersistService {
      * @param databaseName database name
      */
     public void delete(final String databaseName) {
-        
repository.delete(ShardingSphereStatisticsNodePath.getDatabasePath(databaseName));
+        repository.delete(StatisticsNodePath.getDatabasePath(databaseName));
     }
 }
diff --git 
a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/metadata/ShardingSphereStatisticsNodePath.java
 
b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/metadata/StatisticsNodePath.java
similarity index 98%
rename from 
mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/metadata/ShardingSphereStatisticsNodePath.java
rename to 
mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/metadata/StatisticsNodePath.java
index 66d8231270b..c120b9d91b3 100644
--- 
a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/metadata/ShardingSphereStatisticsNodePath.java
+++ 
b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/metadata/StatisticsNodePath.java
@@ -25,10 +25,10 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 /**
- * ShardingSphere statistics node path.
+ * Statistics node path.
  */
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class ShardingSphereStatisticsNodePath {
+public final class StatisticsNodePath {
     
     private static final String ROOT_NODE = "/statistics";
     
diff --git 
a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/ShardingSphereStatisticsNodePathTest.java
 
b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/ShardingSphereStatisticsNodePathTest.java
deleted file mode 100644
index 3bb6fa566d8..00000000000
--- 
a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/ShardingSphereStatisticsNodePathTest.java
+++ /dev/null
@@ -1,114 +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.mode.node.path;
-
-import 
org.apache.shardingsphere.mode.node.path.metadata.ShardingSphereStatisticsNodePath;
-import org.junit.jupiter.api.Test;
-
-import java.util.Optional;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-class ShardingSphereStatisticsNodePathTest {
-    
-    @Test
-    void assertGetDatabasesRootPath() {
-        assertThat(ShardingSphereStatisticsNodePath.getDatabasesRootPath(), 
is("/statistics/databases"));
-    }
-    
-    @Test
-    void assertGetDatabasePath() {
-        assertThat(ShardingSphereStatisticsNodePath.getDatabasePath("foo_db"), 
is("/statistics/databases/foo_db"));
-    }
-    
-    @Test
-    void assertGetSchemaRootPath() {
-        
assertThat(ShardingSphereStatisticsNodePath.getSchemaRootPath("foo_db"), 
is("/statistics/databases/foo_db/schemas"));
-    }
-    
-    @Test
-    void assertGetSchemaPath() {
-        assertThat(ShardingSphereStatisticsNodePath.getSchemaPath("foo_db", 
"db_schema"), is("/statistics/databases/foo_db/schemas/db_schema"));
-    }
-    
-    @Test
-    void assertGetTableRootPath() {
-        assertThat(ShardingSphereStatisticsNodePath.getTableRootPath("foo_db", 
"db_schema"), is("/statistics/databases/foo_db/schemas/db_schema/tables"));
-    }
-    
-    @Test
-    void assertGetTablePath() {
-        assertThat(ShardingSphereStatisticsNodePath.getTablePath("foo_db", 
"db_schema", "tbl_name"), 
is("/statistics/databases/foo_db/schemas/db_schema/tables/tbl_name"));
-    }
-    
-    @Test
-    void assertGetTableRowPath() {
-        assertThat(ShardingSphereStatisticsNodePath.getTableRowPath("foo_db", 
"db_schema", "tbl_name", "key"), 
is("/statistics/databases/foo_db/schemas/db_schema/tables/tbl_name/key"));
-    }
-    
-    @Test
-    void assertFindDatabaseNameWithNotContainsChildPath() {
-        
assertThat(ShardingSphereStatisticsNodePath.findDatabaseName("/statistics/databases/foo_db",
 false), is(Optional.of("foo_db")));
-        
assertThat(ShardingSphereStatisticsNodePath.findDatabaseName("/statistics/databases",
 false), is(Optional.empty()));
-    }
-    
-    @Test
-    void assertFindDatabaseNameWithContainsChildPath() {
-        
assertThat(ShardingSphereStatisticsNodePath.findDatabaseName("/statistics/databases/foo_db",
 true), is(Optional.of("foo_db")));
-        
assertThat(ShardingSphereStatisticsNodePath.findDatabaseName("/statistics/databases/foo_db/schemas/db_schema",
 true), is(Optional.of("foo_db")));
-        
assertThat(ShardingSphereStatisticsNodePath.findDatabaseName("/statistics/databases",
 true), is(Optional.empty()));
-    }
-    
-    @Test
-    void assertFindSchemaNameWithNotContainsChildPath() {
-        
assertThat(ShardingSphereStatisticsNodePath.findSchemaName("/statistics/databases/foo_db/schemas/foo_schema",
 false), is(Optional.of("foo_schema")));
-        
assertThat(ShardingSphereStatisticsNodePath.findSchemaName("/statistics/databases/foo_db",
 false), is(Optional.empty()));
-    }
-    
-    @Test
-    void assertFindSchemaNameWithContainsChildPath() {
-        
assertThat(ShardingSphereStatisticsNodePath.findSchemaName("/statistics/databases/foo_db/schemas/foo_schema",
 true), is(Optional.of("foo_schema")));
-        
assertThat(ShardingSphereStatisticsNodePath.findSchemaName("/statistics/databases/foo_db/schemas/foo_schema/tables/foo_tbl",
 true), is(Optional.of("foo_schema")));
-        
assertThat(ShardingSphereStatisticsNodePath.findSchemaName("/statistics/databases/foo_db",
 true), is(Optional.empty()));
-    }
-    
-    @Test
-    void assertFindTableNameWithNotContainsChildPath() {
-        
assertThat(ShardingSphereStatisticsNodePath.findTableName("/statistics/databases/foo_db/schemas/foo_schema/tables/tbl_name",
 false), is(Optional.of("tbl_name")));
-        
assertThat(ShardingSphereStatisticsNodePath.findTableName("/statistics/databases/foo_db/schemas/foo_schema",
 false), is(Optional.empty()));
-    }
-    
-    @Test
-    void assertFindTableNameWithContainsChildPath() {
-        
assertThat(ShardingSphereStatisticsNodePath.findTableName("/statistics/databases/foo_db/schemas/foo_schema/tables/tbl_name",
 true), is(Optional.of("tbl_name")));
-        
assertThat(ShardingSphereStatisticsNodePath.findTableName("/statistics/databases/foo_db/schemas/foo_schema/tables/tbl_name/key",
 true), is(Optional.of("tbl_name")));
-        
assertThat(ShardingSphereStatisticsNodePath.findTableName("/statistics/databases/foo_db/schemas/foo_schema/tables",
 true), is(Optional.empty()));
-    }
-    
-    @Test
-    void assertFindRowUniqueKey() {
-        
assertThat(ShardingSphereStatisticsNodePath.findRowUniqueKey("/statistics/databases/foo_db/schemas/foo_schema/tables/tbl_name/key"),
 is(Optional.of("key")));
-        
assertThat(ShardingSphereStatisticsNodePath.findRowUniqueKey("/statistics/databases/foo_db/schemas/foo_schema/tables/tbl_name"),
 is(Optional.empty()));
-    }
-    
-    @Test
-    void assertGetJobPath() {
-        assertThat(ShardingSphereStatisticsNodePath.getJobPath(), 
is("/statistics/job"));
-    }
-}
diff --git 
a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/StatisticsNodePathTest.java
 
b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/StatisticsNodePathTest.java
new file mode 100644
index 00000000000..a49cf56f24d
--- /dev/null
+++ 
b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/StatisticsNodePathTest.java
@@ -0,0 +1,114 @@
+/*
+ * 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.mode.node.path;
+
+import org.apache.shardingsphere.mode.node.path.metadata.StatisticsNodePath;
+import org.junit.jupiter.api.Test;
+
+import java.util.Optional;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+class StatisticsNodePathTest {
+    
+    @Test
+    void assertGetDatabasesRootPath() {
+        assertThat(StatisticsNodePath.getDatabasesRootPath(), 
is("/statistics/databases"));
+    }
+    
+    @Test
+    void assertGetDatabasePath() {
+        assertThat(StatisticsNodePath.getDatabasePath("foo_db"), 
is("/statistics/databases/foo_db"));
+    }
+    
+    @Test
+    void assertGetSchemaRootPath() {
+        assertThat(StatisticsNodePath.getSchemaRootPath("foo_db"), 
is("/statistics/databases/foo_db/schemas"));
+    }
+    
+    @Test
+    void assertGetSchemaPath() {
+        assertThat(StatisticsNodePath.getSchemaPath("foo_db", "db_schema"), 
is("/statistics/databases/foo_db/schemas/db_schema"));
+    }
+    
+    @Test
+    void assertGetTableRootPath() {
+        assertThat(StatisticsNodePath.getTableRootPath("foo_db", "db_schema"), 
is("/statistics/databases/foo_db/schemas/db_schema/tables"));
+    }
+    
+    @Test
+    void assertGetTablePath() {
+        assertThat(StatisticsNodePath.getTablePath("foo_db", "db_schema", 
"tbl_name"), 
is("/statistics/databases/foo_db/schemas/db_schema/tables/tbl_name"));
+    }
+    
+    @Test
+    void assertGetTableRowPath() {
+        assertThat(StatisticsNodePath.getTableRowPath("foo_db", "db_schema", 
"tbl_name", "key"), 
is("/statistics/databases/foo_db/schemas/db_schema/tables/tbl_name/key"));
+    }
+    
+    @Test
+    void assertFindDatabaseNameWithNotContainsChildPath() {
+        
assertThat(StatisticsNodePath.findDatabaseName("/statistics/databases/foo_db", 
false), is(Optional.of("foo_db")));
+        
assertThat(StatisticsNodePath.findDatabaseName("/statistics/databases", false), 
is(Optional.empty()));
+    }
+    
+    @Test
+    void assertFindDatabaseNameWithContainsChildPath() {
+        
assertThat(StatisticsNodePath.findDatabaseName("/statistics/databases/foo_db", 
true), is(Optional.of("foo_db")));
+        
assertThat(StatisticsNodePath.findDatabaseName("/statistics/databases/foo_db/schemas/db_schema",
 true), is(Optional.of("foo_db")));
+        
assertThat(StatisticsNodePath.findDatabaseName("/statistics/databases", true), 
is(Optional.empty()));
+    }
+    
+    @Test
+    void assertFindSchemaNameWithNotContainsChildPath() {
+        
assertThat(StatisticsNodePath.findSchemaName("/statistics/databases/foo_db/schemas/foo_schema",
 false), is(Optional.of("foo_schema")));
+        
assertThat(StatisticsNodePath.findSchemaName("/statistics/databases/foo_db", 
false), is(Optional.empty()));
+    }
+    
+    @Test
+    void assertFindSchemaNameWithContainsChildPath() {
+        
assertThat(StatisticsNodePath.findSchemaName("/statistics/databases/foo_db/schemas/foo_schema",
 true), is(Optional.of("foo_schema")));
+        
assertThat(StatisticsNodePath.findSchemaName("/statistics/databases/foo_db/schemas/foo_schema/tables/foo_tbl",
 true), is(Optional.of("foo_schema")));
+        
assertThat(StatisticsNodePath.findSchemaName("/statistics/databases/foo_db", 
true), is(Optional.empty()));
+    }
+    
+    @Test
+    void assertFindTableNameWithNotContainsChildPath() {
+        
assertThat(StatisticsNodePath.findTableName("/statistics/databases/foo_db/schemas/foo_schema/tables/tbl_name",
 false), is(Optional.of("tbl_name")));
+        
assertThat(StatisticsNodePath.findTableName("/statistics/databases/foo_db/schemas/foo_schema",
 false), is(Optional.empty()));
+    }
+    
+    @Test
+    void assertFindTableNameWithContainsChildPath() {
+        
assertThat(StatisticsNodePath.findTableName("/statistics/databases/foo_db/schemas/foo_schema/tables/tbl_name",
 true), is(Optional.of("tbl_name")));
+        
assertThat(StatisticsNodePath.findTableName("/statistics/databases/foo_db/schemas/foo_schema/tables/tbl_name/key",
 true), is(Optional.of("tbl_name")));
+        
assertThat(StatisticsNodePath.findTableName("/statistics/databases/foo_db/schemas/foo_schema/tables",
 true), is(Optional.empty()));
+    }
+    
+    @Test
+    void assertFindRowUniqueKey() {
+        
assertThat(StatisticsNodePath.findRowUniqueKey("/statistics/databases/foo_db/schemas/foo_schema/tables/tbl_name/key"),
 is(Optional.of("key")));
+        
assertThat(StatisticsNodePath.findRowUniqueKey("/statistics/databases/foo_db/schemas/foo_schema/tables/tbl_name"),
 is(Optional.empty()));
+    }
+    
+    @Test
+    void assertGetJobPath() {
+        assertThat(StatisticsNodePath.getJobPath(), is("/statistics/job"));
+    }
+}
diff --git 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/StatisticsChangedHandler.java
 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/StatisticsChangedHandler.java
index 5cd5041e8b8..e5654b820d6 100644
--- 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/StatisticsChangedHandler.java
+++ 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/StatisticsChangedHandler.java
@@ -21,7 +21,7 @@ import com.google.common.base.Strings;
 import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
 import org.apache.shardingsphere.infra.yaml.data.pojo.YamlRowStatistics;
 import 
org.apache.shardingsphere.mode.manager.cluster.dispatch.handler.global.GlobalDataChangedEventHandler;
-import 
org.apache.shardingsphere.mode.node.path.metadata.ShardingSphereStatisticsNodePath;
+import org.apache.shardingsphere.mode.node.path.metadata.StatisticsNodePath;
 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 StatisticsChangedHandler implements 
GlobalDataChangedEventHan
     
     @Override
     public String getSubscribedKey() {
-        return ShardingSphereStatisticsNodePath.getDatabasesRootPath();
+        return StatisticsNodePath.getDatabasesRootPath();
     }
     
     @Override
@@ -49,34 +49,34 @@ public final class StatisticsChangedHandler implements 
GlobalDataChangedEventHan
     @Override
     public void handle(final ContextManager contextManager, final 
DataChangedEvent event) {
         StatisticsManager databaseManager = 
contextManager.getMetaDataContextManager().getStatisticsManager();
-        Optional<String> databaseName = 
ShardingSphereStatisticsNodePath.findDatabaseName(event.getKey(), false);
+        Optional<String> databaseName = 
StatisticsNodePath.findDatabaseName(event.getKey(), false);
         if (databaseName.isPresent()) {
             handleDatabaseChanged(databaseManager, event.getType(), 
databaseName.get());
             return;
         }
-        databaseName = 
ShardingSphereStatisticsNodePath.findDatabaseName(event.getKey(), true);
+        databaseName = StatisticsNodePath.findDatabaseName(event.getKey(), 
true);
         if (!databaseName.isPresent()) {
             return;
         }
-        Optional<String> schemaName = 
ShardingSphereStatisticsNodePath.findSchemaName(event.getKey(), false);
+        Optional<String> schemaName = 
StatisticsNodePath.findSchemaName(event.getKey(), false);
         if (schemaName.isPresent()) {
             handleSchemaChanged(databaseManager, event.getType(), 
databaseName.get(), schemaName.get());
             return;
         }
-        schemaName = 
ShardingSphereStatisticsNodePath.findSchemaName(event.getKey(), true);
+        schemaName = StatisticsNodePath.findSchemaName(event.getKey(), true);
         if (!schemaName.isPresent()) {
             return;
         }
-        Optional<String> tableName = 
ShardingSphereStatisticsNodePath.findTableName(event.getKey(), false);
+        Optional<String> tableName = 
StatisticsNodePath.findTableName(event.getKey(), false);
         if (tableName.isPresent()) {
             handleTableChanged(databaseManager, event.getType(), 
databaseName.get(), schemaName.get(), tableName.get());
             return;
         }
-        tableName = 
ShardingSphereStatisticsNodePath.findTableName(event.getKey(), true);
+        tableName = StatisticsNodePath.findTableName(event.getKey(), true);
         if (!tableName.isPresent()) {
             return;
         }
-        Optional<String> uniqueKey = 
ShardingSphereStatisticsNodePath.findRowUniqueKey(event.getKey());
+        Optional<String> uniqueKey = 
StatisticsNodePath.findRowUniqueKey(event.getKey());
         if (uniqueKey.isPresent()) {
             handleRowDataChanged(databaseManager, event.getType(), 
event.getValue(), databaseName.get(), schemaName.get(), tableName.get(), 
uniqueKey.get());
         }

Reply via email to