This is an automated email from the ASF dual-hosted git repository.

sunnianjun 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 6f908e29633 Rename ClusterStatus to ClusterState (#31315)
6f908e29633 is described below

commit 6f908e296332c5b445c02e755b8d66b8544bc81d
Author: Haoran Meng <[email protected]>
AuthorDate: Mon May 20 19:28:34 2024 +0800

    Rename ClusterStatus to ClusterState (#31315)
---
 .../shardingsphere/metadata/persist/node/ComputeNode.java    |  6 +++---
 ...lusterStatusException.java => ClusterStateException.java} |  8 ++++----
 .../org/apache/shardingsphere/mode/state/StateService.java   |  6 +++---
 .../shardingsphere/mode/manager/ContextManagerTest.java      |  2 +-
 .../apache/shardingsphere/mode/state/StateServiceTest.java   |  8 ++++----
 .../mode/manager/cluster/ClusterContextManagerBuilder.java   |  4 ++--
 ...StatusChangedEvent.java => ClusterStateChangedEvent.java} |  4 ++--
 ...sterStatusSubscriber.java => ClusterStateSubscriber.java} | 10 +++++-----
 .../status/cluster/watcher/ClusterStateChangedWatcher.java   |  6 +++---
 .../coordinator/subscriber/StateChangedSubscriber.java       |  4 ++--
 ...usSubscriberTest.java => ClusterStateSubscriberTest.java} | 12 ++++++------
 .../coordinator/subscriber/StateChangedSubscriberTest.java   |  6 +++---
 .../handler/distsql/ral/updatable/UnlockClusterExecutor.java |  4 ++--
 .../backend/lock/impl/ClusterReadWriteLockStrategy.java      |  4 ++--
 .../proxy/backend/lock/impl/ClusterWriteLockStrategy.java    |  4 ++--
 .../proxy/backend/state/impl/ReadOnlyProxyState.java         |  4 ++--
 .../proxy/backend/state/impl/UnavailableProxyState.java      |  4 ++--
 .../proxy/backend/state/impl/ReadOnlyProxyStateTest.java     |  4 ++--
 .../proxy/backend/state/impl/UnavailableProxyStateTest.java  |  4 ++--
 19 files changed, 52 insertions(+), 52 deletions(-)

diff --git 
a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/ComputeNode.java
 
b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/ComputeNode.java
index 5749223a6ed..8496914cb3f 100644
--- 
a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/ComputeNode.java
+++ 
b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/ComputeNode.java
@@ -167,11 +167,11 @@ public final class ComputeNode {
     }
     
     /**
-     * Get cluster status node path.
+     * Get cluster state node path.
      * 
-     * @return cluster status node path
+     * @return cluster state node path
      */
-    public static String getClusterStatusNodePath() {
+    public static String getClusterStateNodePath() {
         return String.join("/", "", ROOT_NODE, COMPUTE_NODE, STATUS_NODE);
     }
     
diff --git 
a/mode/core/src/main/java/org/apache/shardingsphere/mode/exception/ClusterStatusException.java
 
b/mode/core/src/main/java/org/apache/shardingsphere/mode/exception/ClusterStateException.java
similarity index 81%
rename from 
mode/core/src/main/java/org/apache/shardingsphere/mode/exception/ClusterStatusException.java
rename to 
mode/core/src/main/java/org/apache/shardingsphere/mode/exception/ClusterStateException.java
index bf7d2e89d4f..10155eb0f09 100644
--- 
a/mode/core/src/main/java/org/apache/shardingsphere/mode/exception/ClusterStatusException.java
+++ 
b/mode/core/src/main/java/org/apache/shardingsphere/mode/exception/ClusterStateException.java
@@ -22,13 +22,13 @@ import 
org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.c
 import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
 
 /**
- * Cluster status exception.
+ * Cluster state exception.
  */
-public final class ClusterStatusException extends ClusterSQLException {
+public final class ClusterStateException extends ClusterSQLException {
     
     private static final long serialVersionUID = 3834132923835083492L;
     
-    public ClusterStatusException(final String type, final SQLStatement 
sqlStatement) {
-        super(XOpenSQLState.GENERAL_ERROR, 20, "The cluster status is %s, can 
not support SQL statement '%s'.", type, 
sqlStatement.getClass().getSimpleName());
+    public ClusterStateException(final String type, final SQLStatement 
sqlStatement) {
+        super(XOpenSQLState.GENERAL_ERROR, 20, "The cluster state is %s, can 
not support SQL statement '%s'.", type, 
sqlStatement.getClass().getSimpleName());
     }
 }
diff --git 
a/mode/core/src/main/java/org/apache/shardingsphere/mode/state/StateService.java
 
b/mode/core/src/main/java/org/apache/shardingsphere/mode/state/StateService.java
index 0acc8c90168..b9eca600be4 100644
--- 
a/mode/core/src/main/java/org/apache/shardingsphere/mode/state/StateService.java
+++ 
b/mode/core/src/main/java/org/apache/shardingsphere/mode/state/StateService.java
@@ -39,8 +39,8 @@ public final class StateService {
      * @param state cluster state
      */
     public void persist(final ClusterState state) {
-        if 
(Strings.isNullOrEmpty(repository.getDirectly(ComputeNode.getClusterStatusNodePath())))
 {
-            repository.persist(ComputeNode.getClusterStatusNodePath(), 
state.name());
+        if 
(Strings.isNullOrEmpty(repository.getDirectly(ComputeNode.getClusterStateNodePath())))
 {
+            repository.persist(ComputeNode.getClusterStateNodePath(), 
state.name());
         }
     }
     
@@ -50,7 +50,7 @@ public final class StateService {
      * @return cluster state
      */
     public Optional<ClusterState> load() {
-        String value = 
repository.getDirectly(ComputeNode.getClusterStatusNodePath());
+        String value = 
repository.getDirectly(ComputeNode.getClusterStateNodePath());
         return Strings.isNullOrEmpty(value) ? Optional.empty() : 
Optional.of(ClusterState.valueOf(value));
     }
 }
diff --git 
a/mode/core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerTest.java
 
b/mode/core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerTest.java
index a6a9258fae6..2b3cf8af9f7 100644
--- 
a/mode/core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerTest.java
+++ 
b/mode/core/src/test/java/org/apache/shardingsphere/mode/manager/ContextManagerTest.java
@@ -265,7 +265,7 @@ class ContextManagerTest {
     }
     
     @Test
-    void assertUpdateClusterStatus() {
+    void assertUpdateClusterState() {
         contextManager.updateClusterState(ClusterState.READ_ONLY);
         assertThat(contextManager.getStateContext().getCurrentState(), 
is(ClusterState.READ_ONLY));
     }
diff --git 
a/mode/core/src/test/java/org/apache/shardingsphere/mode/state/StateServiceTest.java
 
b/mode/core/src/test/java/org/apache/shardingsphere/mode/state/StateServiceTest.java
index 8eaac941c2a..354674cb9e9 100644
--- 
a/mode/core/src/test/java/org/apache/shardingsphere/mode/state/StateServiceTest.java
+++ 
b/mode/core/src/test/java/org/apache/shardingsphere/mode/state/StateServiceTest.java
@@ -39,7 +39,7 @@ class StateServiceTest {
     void assertPersistClusterStateWithoutPath() {
         StateService stateService = new StateService(repository);
         stateService.persist(ClusterState.OK);
-        verify(repository).persist(ComputeNode.getClusterStatusNodePath(), 
ClusterState.OK.name());
+        verify(repository).persist(ComputeNode.getClusterStateNodePath(), 
ClusterState.OK.name());
     }
     
     @Test
@@ -47,12 +47,12 @@ class StateServiceTest {
         StateService stateService = new StateService(repository);
         
when(repository.getDirectly("/nodes/compute_nodes/status")).thenReturn(ClusterState.OK.name());
         stateService.persist(ClusterState.OK);
-        verify(repository, 
times(0)).persist(ComputeNode.getClusterStatusNodePath(), 
ClusterState.OK.name());
+        verify(repository, 
times(0)).persist(ComputeNode.getClusterStateNodePath(), 
ClusterState.OK.name());
     }
     
     @Test
-    void assertLoadClusterStatus() {
+    void assertLoadClusterState() {
         new StateService(repository).load();
-        verify(repository).getDirectly(ComputeNode.getClusterStatusNodePath());
+        verify(repository).getDirectly(ComputeNode.getClusterStateNodePath());
     }
 }
diff --git 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
index aaf22d6776e..959e636be33 100644
--- 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
+++ 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
@@ -37,7 +37,7 @@ import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.GlobalLoc
 import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.GovernanceWatcherFactory;
 import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.metadata.subscriber.ShardingSphereSchemaDataRegistrySubscriber;
 import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.process.subscriber.ClusterProcessSubscriber;
-import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.cluster.subscriber.ClusterStatusSubscriber;
+import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.cluster.subscriber.ClusterStateSubscriber;
 import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.service.ComputeNodeStatusService;
 import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.subscriber.ComputeNodeStatusSubscriber;
 import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.storage.subscriber.QualifiedDataSourceStatusSubscriber;
@@ -106,7 +106,7 @@ public final class ClusterContextManagerBuilder implements 
ContextManagerBuilder
     // TODO remove the method, only keep ZooKeeper's events, remove all 
decouple events
     private void createSubscribers(final EventBusContext eventBusContext, 
final ClusterPersistRepository repository) {
         eventBusContext.register(new ComputeNodeStatusSubscriber(repository));
-        eventBusContext.register(new ClusterStatusSubscriber(repository));
+        eventBusContext.register(new ClusterStateSubscriber(repository));
         eventBusContext.register(new 
QualifiedDataSourceStatusSubscriber(repository));
         eventBusContext.register(new ClusterProcessSubscriber(repository, 
eventBusContext));
         eventBusContext.register(new 
ShardingSphereSchemaDataRegistrySubscriber(repository));
diff --git 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/cluster/event/ClusterStatusChangedEvent.java
 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/cluster/event/ClusterStateChangedEvent.java
similarity index 93%
rename from 
mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/cluster/event/ClusterStatusChangedEvent.java
rename to 
mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/cluster/event/ClusterStateChangedEvent.java
index 88948bd713d..5c3b1627fbd 100644
--- 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/cluster/event/ClusterStatusChangedEvent.java
+++ 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/cluster/event/ClusterStateChangedEvent.java
@@ -22,11 +22,11 @@ import lombok.RequiredArgsConstructor;
 import org.apache.shardingsphere.infra.state.cluster.ClusterState;
 
 /**
- * Cluster status changed event.
+ * Cluster state changed event.
  */
 @RequiredArgsConstructor
 @Getter
-public final class ClusterStatusChangedEvent {
+public final class ClusterStateChangedEvent {
     
     private final ClusterState state;
 }
diff --git 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/cluster/subscriber/ClusterStatusSubscriber.java
 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/cluster/subscriber/ClusterStateSubscriber.java
similarity index 82%
rename from 
mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/cluster/subscriber/ClusterStatusSubscriber.java
rename to 
mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/cluster/subscriber/ClusterStateSubscriber.java
index da35826018e..84ee0bb09e3 100644
--- 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/cluster/subscriber/ClusterStatusSubscriber.java
+++ 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/cluster/subscriber/ClusterStateSubscriber.java
@@ -21,14 +21,14 @@ import com.google.common.eventbus.Subscribe;
 import lombok.RequiredArgsConstructor;
 import org.apache.shardingsphere.infra.util.eventbus.EventSubscriber;
 import org.apache.shardingsphere.metadata.persist.node.ComputeNode;
-import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.cluster.event.ClusterStatusChangedEvent;
+import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.cluster.event.ClusterStateChangedEvent;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
 
 /**
- * Cluster status subscriber.
+ * Cluster state subscriber.
  */
 @RequiredArgsConstructor
-public final class ClusterStatusSubscriber implements EventSubscriber {
+public final class ClusterStateSubscriber implements EventSubscriber {
     
     private final ClusterPersistRepository repository;
     
@@ -38,7 +38,7 @@ public final class ClusterStatusSubscriber implements 
EventSubscriber {
      * @param event cluster status changed event
      */
     @Subscribe
-    public void update(final ClusterStatusChangedEvent event) {
-        repository.persist(ComputeNode.getClusterStatusNodePath(), 
event.getState().name());
+    public void update(final ClusterStateChangedEvent event) {
+        repository.persist(ComputeNode.getClusterStateNodePath(), 
event.getState().name());
     }
 }
diff --git 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/cluster/watcher/ClusterStateChangedWatcher.java
 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/cluster/watcher/ClusterStateChangedWatcher.java
index 7f3b8dd40a6..716056ccbb3 100644
--- 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/cluster/watcher/ClusterStateChangedWatcher.java
+++ 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/cluster/watcher/ClusterStateChangedWatcher.java
@@ -38,7 +38,7 @@ public final class ClusterStateChangedWatcher implements 
GovernanceWatcher<Gover
     
     @Override
     public Collection<String> getWatchingKeys(final Collection<String> 
databaseNames) {
-        return Collections.singleton(ComputeNode.getClusterStatusNodePath());
+        return Collections.singleton(ComputeNode.getClusterStateNodePath());
     }
     
     @Override
@@ -48,8 +48,8 @@ public final class ClusterStateChangedWatcher implements 
GovernanceWatcher<Gover
     
     @Override
     public Optional<GovernanceEvent> createGovernanceEvent(final 
DataChangedEvent event) {
-        String clusterStatusPath = ComputeNode.getClusterStatusNodePath();
-        return Strings.isNullOrEmpty(clusterStatusPath) || Type.DELETED == 
event.getType() || 
!event.getKey().equals(ComputeNode.getClusterStatusNodePath())
+        String clusterStatePath = ComputeNode.getClusterStateNodePath();
+        return Strings.isNullOrEmpty(clusterStatePath) || Type.DELETED == 
event.getType() || !event.getKey().equals(ComputeNode.getClusterStateNodePath())
                 ? Optional.empty()
                 : Optional.of(new ClusterStateEvent(getClusterState(event)));
     }
diff --git 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/StateChangedSubscriber.java
 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/StateChangedSubscriber.java
index ad32e369ef3..c288594dbe5 100644
--- 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/StateChangedSubscriber.java
+++ 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/StateChangedSubscriber.java
@@ -28,7 +28,7 @@ import 
org.apache.shardingsphere.infra.util.eventbus.EventSubscriber;
 import org.apache.shardingsphere.mode.manager.ContextManager;
 import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.cluster.event.ClusterLockDeletedEvent;
 import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.cluster.event.ClusterStateEvent;
-import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.cluster.event.ClusterStatusChangedEvent;
+import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.cluster.event.ClusterStateChangedEvent;
 import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.InstanceOfflineEvent;
 import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.InstanceOnlineEvent;
 import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.LabelsEvent;
@@ -78,7 +78,7 @@ public final class StateChangedSubscriber implements 
EventSubscriber {
      */
     @Subscribe
     public synchronized void renew(final ClusterLockDeletedEvent event) {
-        
contextManager.getComputeNodeInstanceContext().getEventBusContext().post(new 
ClusterStatusChangedEvent(event.getState()));
+        
contextManager.getComputeNodeInstanceContext().getEventBusContext().post(new 
ClusterStateChangedEvent(event.getState()));
     }
     
     /**
diff --git 
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/cluster/subscriber/ClusterStatusSubscriberTest.java
 
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/cluster/subscriber/ClusterStateSubscriberTest.java
similarity index 78%
rename from 
mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/cluster/subscriber/ClusterStatusSubscriberTest.java
rename to 
mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/cluster/subscriber/ClusterStateSubscriberTest.java
index 110e7395af4..02ddf8c68d4 100644
--- 
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/cluster/subscriber/ClusterStatusSubscriberTest.java
+++ 
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/cluster/subscriber/ClusterStateSubscriberTest.java
@@ -19,7 +19,7 @@ package 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.stat
 
 import org.apache.shardingsphere.infra.state.cluster.ClusterState;
 import org.apache.shardingsphere.metadata.persist.node.ComputeNode;
-import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.cluster.event.ClusterStatusChangedEvent;
+import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.cluster.event.ClusterStateChangedEvent;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
@@ -29,16 +29,16 @@ import org.mockito.junit.jupiter.MockitoExtension;
 import static org.mockito.Mockito.verify;
 
 @ExtendWith(MockitoExtension.class)
-class ClusterStatusSubscriberTest {
+class ClusterStateSubscriberTest {
     
     @Mock
     private ClusterPersistRepository repository;
     
     @Test
     void assertUpdate() {
-        ClusterStatusSubscriber clusterStatusSubscriber = new 
ClusterStatusSubscriber(repository);
-        ClusterStatusChangedEvent event = new 
ClusterStatusChangedEvent(ClusterState.OK);
-        clusterStatusSubscriber.update(event);
-        verify(repository).persist(ComputeNode.getClusterStatusNodePath(), 
ClusterState.OK.name());
+        ClusterStateSubscriber clusterStateSubscriber = new 
ClusterStateSubscriber(repository);
+        ClusterStateChangedEvent event = new 
ClusterStateChangedEvent(ClusterState.OK);
+        clusterStateSubscriber.update(event);
+        verify(repository).persist(ComputeNode.getClusterStateNodePath(), 
ClusterState.OK.name());
     }
 }
diff --git 
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/StateChangedSubscriberTest.java
 
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/StateChangedSubscriberTest.java
index b8f60e4ba28..c412cd7b583 100644
--- 
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/StateChangedSubscriberTest.java
+++ 
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/StateChangedSubscriberTest.java
@@ -122,21 +122,21 @@ class StateChangedSubscriberTest {
     }
     
     @Test
-    void assertResetClusterStatus() {
+    void assertResetClusterState() {
         ClusterLockDeletedEvent mockLockDeletedEvent = new 
ClusterLockDeletedEvent(ClusterState.OK);
         subscriber.renew(mockLockDeletedEvent);
         assertThat(contextManager.getStateContext().getCurrentState(), 
is(ClusterState.OK));
     }
     
     @Test
-    void assertRenewClusterStatus() {
+    void assertRenewClusterState() {
         ClusterStateEvent mockClusterStateEvent = new 
ClusterStateEvent(ClusterState.READ_ONLY);
         subscriber.renew(mockClusterStateEvent);
         assertThat(contextManager.getStateContext().getCurrentState(), 
is(ClusterState.READ_ONLY));
     }
     
     @Test
-    void assertRenewInstanceStatus() {
+    void assertRenewInstanceState() {
         ComputeNodeInstanceStateChangedEvent event = new 
ComputeNodeInstanceStateChangedEvent(
                 
contextManager.getComputeNodeInstanceContext().getInstance().getMetaData().getId(),
 InstanceState.OK.name());
         subscriber.renew(event);
diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/UnlockClusterExecutor.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/UnlockClusterExecutor.java
index 24904d5a88b..6150aa84b71 100644
--- 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/UnlockClusterExecutor.java
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/UnlockClusterExecutor.java
@@ -27,7 +27,7 @@ import 
org.apache.shardingsphere.infra.state.cluster.ClusterState;
 import org.apache.shardingsphere.mode.exception.NotLockedClusterException;
 import org.apache.shardingsphere.mode.lock.GlobalLockDefinition;
 import org.apache.shardingsphere.mode.manager.ContextManager;
-import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.cluster.event.ClusterStatusChangedEvent;
+import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.cluster.event.ClusterStateChangedEvent;
 
 /**
  * Unlock cluster executor.
@@ -44,7 +44,7 @@ public final class UnlockClusterExecutor implements 
DistSQLUpdateExecutor<Unlock
         if (lockContext.tryLock(lockDefinition, 3000L)) {
             try {
                 checkState(contextManager);
-                
contextManager.getComputeNodeInstanceContext().getEventBusContext().post(new 
ClusterStatusChangedEvent(ClusterState.OK));
+                
contextManager.getComputeNodeInstanceContext().getEventBusContext().post(new 
ClusterStateChangedEvent(ClusterState.OK));
                 // TODO unlock snapshot info if locked
             } finally {
                 lockContext.unlock(lockDefinition);
diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/lock/impl/ClusterReadWriteLockStrategy.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/lock/impl/ClusterReadWriteLockStrategy.java
index 2f1f6655db0..cb9dee9d592 100644
--- 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/lock/impl/ClusterReadWriteLockStrategy.java
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/lock/impl/ClusterReadWriteLockStrategy.java
@@ -18,7 +18,7 @@
 package org.apache.shardingsphere.proxy.backend.lock.impl;
 
 import org.apache.shardingsphere.infra.state.cluster.ClusterState;
-import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.cluster.event.ClusterStatusChangedEvent;
+import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.cluster.event.ClusterStateChangedEvent;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
 import org.apache.shardingsphere.proxy.backend.lock.spi.ClusterLockStrategy;
 
@@ -29,7 +29,7 @@ public class ClusterReadWriteLockStrategy implements 
ClusterLockStrategy {
     
     @Override
     public void lock() {
-        
ProxyContext.getInstance().getContextManager().getComputeNodeInstanceContext().getEventBusContext().post(new
 ClusterStatusChangedEvent(ClusterState.UNAVAILABLE));
+        
ProxyContext.getInstance().getContextManager().getComputeNodeInstanceContext().getEventBusContext().post(new
 ClusterStateChangedEvent(ClusterState.UNAVAILABLE));
     }
     
     @Override
diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/lock/impl/ClusterWriteLockStrategy.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/lock/impl/ClusterWriteLockStrategy.java
index 7145c0b2f7c..48dd3449e21 100644
--- 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/lock/impl/ClusterWriteLockStrategy.java
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/lock/impl/ClusterWriteLockStrategy.java
@@ -18,7 +18,7 @@
 package org.apache.shardingsphere.proxy.backend.lock.impl;
 
 import org.apache.shardingsphere.infra.state.cluster.ClusterState;
-import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.cluster.event.ClusterStatusChangedEvent;
+import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.cluster.event.ClusterStateChangedEvent;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
 import org.apache.shardingsphere.proxy.backend.lock.spi.ClusterLockStrategy;
 
@@ -29,7 +29,7 @@ public class ClusterWriteLockStrategy implements 
ClusterLockStrategy {
     
     @Override
     public void lock() {
-        
ProxyContext.getInstance().getContextManager().getComputeNodeInstanceContext().getEventBusContext().post(new
 ClusterStatusChangedEvent(ClusterState.READ_ONLY));
+        
ProxyContext.getInstance().getContextManager().getComputeNodeInstanceContext().getEventBusContext().post(new
 ClusterStateChangedEvent(ClusterState.READ_ONLY));
     }
     
     @Override
diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/state/impl/ReadOnlyProxyState.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/state/impl/ReadOnlyProxyState.java
index 5f309d00636..6a9e5534c48 100644
--- 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/state/impl/ReadOnlyProxyState.java
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/state/impl/ReadOnlyProxyState.java
@@ -21,7 +21,7 @@ import 
org.apache.shardingsphere.distsql.statement.ral.updatable.UpdatableRALSta
 import 
org.apache.shardingsphere.distsql.statement.ral.updatable.UnlockClusterStatement;
 import org.apache.shardingsphere.distsql.statement.rdl.RDLStatement;
 import 
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
-import org.apache.shardingsphere.mode.exception.ClusterStatusException;
+import org.apache.shardingsphere.mode.exception.ClusterStateException;
 import org.apache.shardingsphere.proxy.backend.state.ProxyClusterState;
 import org.apache.shardingsphere.proxy.backend.state.SQLSupportedJudgeEngine;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
@@ -48,7 +48,7 @@ public final class ReadOnlyProxyState implements 
ProxyClusterState {
     
     @Override
     public void check(final SQLStatement sqlStatement) {
-        
ShardingSpherePreconditions.checkState(judgeEngine.isSupported(sqlStatement), 
() -> new ClusterStatusException(getType(), sqlStatement));
+        
ShardingSpherePreconditions.checkState(judgeEngine.isSupported(sqlStatement), 
() -> new ClusterStateException(getType(), sqlStatement));
     }
     
     @Override
diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/state/impl/UnavailableProxyState.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/state/impl/UnavailableProxyState.java
index b26aed7613a..d965fe86daa 100644
--- 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/state/impl/UnavailableProxyState.java
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/state/impl/UnavailableProxyState.java
@@ -22,7 +22,7 @@ import 
org.apache.shardingsphere.distsql.statement.ral.updatable.ImportMetaDataS
 import 
org.apache.shardingsphere.distsql.statement.ral.updatable.UnlockClusterStatement;
 import org.apache.shardingsphere.distsql.statement.rql.RQLStatement;
 import 
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
-import org.apache.shardingsphere.mode.exception.ClusterStatusException;
+import org.apache.shardingsphere.mode.exception.ClusterStateException;
 import org.apache.shardingsphere.proxy.backend.state.ProxyClusterState;
 import org.apache.shardingsphere.proxy.backend.state.SQLSupportedJudgeEngine;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
@@ -49,7 +49,7 @@ public final class UnavailableProxyState implements 
ProxyClusterState {
     
     @Override
     public void check(final SQLStatement sqlStatement) {
-        
ShardingSpherePreconditions.checkState(judgeEngine.isSupported(sqlStatement), 
() -> new ClusterStatusException(getType(), sqlStatement));
+        
ShardingSpherePreconditions.checkState(judgeEngine.isSupported(sqlStatement), 
() -> new ClusterStateException(getType(), sqlStatement));
     }
     
     @Override
diff --git 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/state/impl/ReadOnlyProxyStateTest.java
 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/state/impl/ReadOnlyProxyStateTest.java
index cc7cc789870..970fc377805 100644
--- 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/state/impl/ReadOnlyProxyStateTest.java
+++ 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/state/impl/ReadOnlyProxyStateTest.java
@@ -17,7 +17,7 @@
 
 package org.apache.shardingsphere.proxy.backend.state.impl;
 
-import org.apache.shardingsphere.mode.exception.ClusterStatusException;
+import org.apache.shardingsphere.mode.exception.ClusterStateException;
 import 
org.apache.shardingsphere.sql.parser.sql.common.statement.dml.InsertStatement;
 import 
org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement;
 import org.junit.jupiter.api.Test;
@@ -29,7 +29,7 @@ class ReadOnlyProxyStateTest {
     
     @Test
     void assertExecuteWithUnsupportedSQL() {
-        assertThrows(ClusterStatusException.class, () -> new 
ReadOnlyProxyState().check(mock(InsertStatement.class)));
+        assertThrows(ClusterStateException.class, () -> new 
ReadOnlyProxyState().check(mock(InsertStatement.class)));
     }
     
     @Test
diff --git 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/state/impl/UnavailableProxyStateTest.java
 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/state/impl/UnavailableProxyStateTest.java
index e617c9ec483..353503cd3b8 100644
--- 
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/state/impl/UnavailableProxyStateTest.java
+++ 
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/state/impl/UnavailableProxyStateTest.java
@@ -18,7 +18,7 @@
 package org.apache.shardingsphere.proxy.backend.state.impl;
 
 import 
org.apache.shardingsphere.distsql.statement.ral.updatable.ImportMetaDataStatement;
-import org.apache.shardingsphere.mode.exception.ClusterStatusException;
+import org.apache.shardingsphere.mode.exception.ClusterStateException;
 import 
org.apache.shardingsphere.sql.parser.sql.common.statement.dml.DMLStatement;
 import org.junit.jupiter.api.Test;
 
@@ -29,7 +29,7 @@ class UnavailableProxyStateTest {
     
     @Test
     void assertExecuteWithUnsupportedSQL() {
-        assertThrows(ClusterStatusException.class, () -> new 
UnavailableProxyState().check(mock(DMLStatement.class)));
+        assertThrows(ClusterStateException.class, () -> new 
UnavailableProxyState().check(mock(DMLStatement.class)));
     }
     
     @Test

Reply via email to