This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 7f52173 rename compute node status CIRCUIT_BREAKER to CIRCUIT_BREAK
(#14701)
7f52173 is described below
commit 7f52173629a7b634d627dbc15f0c2b5db2261138
Author: Haoran Meng <[email protected]>
AuthorDate: Wed Jan 12 11:40:50 2022 +0800
rename compute node status CIRCUIT_BREAKER to CIRCUIT_BREAK (#14701)
---
.../coordinator/registry/status/compute/ComputeNodeStatus.java | 2 +-
.../status/compute/subscriber/ComputeNodeStatusSubscriber.java | 6 +++---
.../status/compute/watcher/ComputeNodeStateChangedWatcher.java | 2 +-
.../status/compute/watcher/ComputeNodeStateChangedWatcherTest.java | 2 +-
.../distsql/ral/common/set/excutor/SetInstanceStatusExecutor.java | 2 +-
.../text/distsql/ral/common/show/executor/ShowInstanceExecutor.java | 2 +-
6 files changed, 8 insertions(+), 8 deletions(-)
diff --git
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/ComputeNodeStatus.java
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/ComputeNodeStatus.java
index 330c5f6..8ecb537 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/ComputeNodeStatus.java
+++
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/ComputeNodeStatus.java
@@ -22,5 +22,5 @@ package
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.stat
*/
public enum ComputeNodeStatus {
- ONLINE, CIRCUIT_BREAKER
+ ONLINE, CIRCUIT_BREAK
}
diff --git
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/subscriber/ComputeNodeStatusSubscriber.java
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/subscriber/ComputeNodeStatus
[...]
index 09f6ff4..79cede9 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/subscriber/ComputeNodeStatusSubscriber.java
+++
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/subscriber/ComputeNodeStatusSubscriber.java
@@ -52,10 +52,10 @@ public final class ComputeNodeStatusSubscriber {
String computeStatusNodePath =
ComputeNode.getInstanceStatusNodePath(new InstanceId(event.getIp(),
Integer.valueOf(event.getPort())).getId());
String yamlContext = repository.get(computeStatusNodePath);
Collection<String> status = Strings.isNullOrEmpty(yamlContext) ? new
ArrayList<>() : YamlEngine.unmarshal(yamlContext, Collection.class);
- if (event.getStatus() == ComputeNodeStatus.CIRCUIT_BREAKER) {
- status.add(ComputeNodeStatus.CIRCUIT_BREAKER.name());
+ if (event.getStatus() == ComputeNodeStatus.CIRCUIT_BREAK) {
+ status.add(ComputeNodeStatus.CIRCUIT_BREAK.name());
} else {
- status.remove(ComputeNodeStatus.CIRCUIT_BREAKER.name());
+ status.remove(ComputeNodeStatus.CIRCUIT_BREAK.name());
}
repository.persist(computeStatusNodePath, YamlEngine.marshal(status));
}
diff --git
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeStateChangedWatcher.java
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeStateChan
[...]
index 350feba..771aa39 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeStateChangedWatcher.java
+++
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeStateChangedWatcher.java
@@ -53,7 +53,7 @@ public final class ComputeNodeStateChangedWatcher implements
GovernanceWatcher<S
String instanceId = ComputeNode.getInstanceIdByStatus(event.getKey());
if (!Strings.isNullOrEmpty(instanceId)) {
Collection<String> status =
Strings.isNullOrEmpty(event.getValue()) ? new ArrayList<>() :
YamlEngine.unmarshal(event.getValue(), Collection.class);
- return Optional.of(new StateEvent(StateType.CIRCUIT_BREAK,
status.contains(ComputeNodeStatus.CIRCUIT_BREAKER.name())));
+ return Optional.of(new StateEvent(StateType.CIRCUIT_BREAK,
status.contains(ComputeNodeStatus.CIRCUIT_BREAK.name())));
}
return Optional.empty();
}
diff --git
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeStateChangedWatcherTest.java
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeState
[...]
index 1e9a251..925b1fb 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeStateChangedWatcherTest.java
+++
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeStateChangedWatcherTest.java
@@ -35,7 +35,7 @@ public final class ComputeNodeStateChangedWatcherTest {
@Test
public void assertCreateEventWhenEnabled() {
Optional<StateEvent> actual = new
ComputeNodeStateChangedWatcher().createGovernanceEvent(new
DataChangedEvent("/nodes/compute_nodes/attributes/127.0.0.1@3307/status",
-
YamlEngine.marshal(Arrays.asList(ComputeNodeStatus.CIRCUIT_BREAKER.name())),
Type.ADDED));
+
YamlEngine.marshal(Arrays.asList(ComputeNodeStatus.CIRCUIT_BREAK.name())),
Type.ADDED));
assertTrue(actual.isPresent());
assertTrue(actual.get().isOn());
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/set/excutor/SetInstanceStatusExecutor.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/set/excutor/SetInstanceStatusExecutor.java
index 4ff64a2..036c8a6 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/set/excutor/SetInstanceStatusExecutor.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/set/excutor/SetInstanceStatusExecutor.java
@@ -38,7 +38,7 @@ public final class SetInstanceStatusExecutor implements
SetStatementExecutor {
@Override
public ResponseHeader execute() throws DistSQLException {
// add more instance check here
- ShardingSphereEventBus.getInstance().post(new
ComputeNodeStatusChangedEvent("DISABLE".equals(sqlStatement.getStatus()) ?
ComputeNodeStatus.CIRCUIT_BREAKER : ComputeNodeStatus.ONLINE,
+ ShardingSphereEventBus.getInstance().post(new
ComputeNodeStatusChangedEvent("DISABLE".equals(sqlStatement.getStatus()) ?
ComputeNodeStatus.CIRCUIT_BREAK : ComputeNodeStatus.ONLINE,
sqlStatement.getIp(), sqlStatement.getPort()));
return new UpdateResponseHeader(sqlStatement);
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ShowInstanceExecutor.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ShowInstanceExecutor.java
index 61d8f5e..4743a1e 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ShowInstanceExecutor.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ShowInstanceExecutor.java
@@ -99,6 +99,6 @@ public final class ShowInstanceExecutor extends
AbstractShowExecutor {
}
private String getStatus(final Collection<String> computeNodeStatus) {
- return computeNodeStatus.isEmpty() ||
!computeNodeStatus.contains(ComputeNodeStatus.CIRCUIT_BREAKER.name()) ? ENABLE
: DISABLE;
+ return computeNodeStatus.isEmpty() ||
!computeNodeStatus.contains(ComputeNodeStatus.CIRCUIT_BREAK.name()) ? ENABLE :
DISABLE;
}
}