This is an automated email from the ASF dual-hosted git repository.
jianglongtao 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 66c06180fee Rename ComputeNodeInstance.metaData (#19272)
66c06180fee is described below
commit 66c06180fee080cf4e18fcbff54157ea4844cc6f
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Jul 16 22:59:30 2022 +0800
Rename ComputeNodeInstance.metaData (#19272)
---
.../infra/instance/ComputeNodeInstance.java | 4 ++--
.../shardingsphere/infra/instance/InstanceContext.java | 16 ++++++++--------
.../mode/metadata/MetaDataContextsFactory.java | 2 +-
.../coordinator/ClusterContextManagerCoordinator.java | 3 ++-
.../mode/manager/cluster/coordinator/RegistryCenter.java | 2 +-
.../lock/manager/internal/ExclusiveInternalLock.java | 2 +-
.../ClusterContextManagerCoordinatorTest.java | 16 ++++++++--------
.../compute/service/ComputeNodeStatusServiceTest.java | 14 +++++++-------
.../zookeeper/listener/SessionConnectionListener.java | 2 +-
.../text/distsql/ral/queryable/ShowInstanceHandler.java | 4 ++--
.../distsql/ral/queryable/ShowInstanceModeHandler.java | 2 +-
.../ral/queryable/ShowInstanceModeHandlerTest.java | 2 +-
12 files changed, 35 insertions(+), 34 deletions(-)
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/ComputeNodeInstance.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/ComputeNodeInstance.java
index adda363dc40..05d9e7318cb 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/ComputeNodeInstance.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/ComputeNodeInstance.java
@@ -34,7 +34,7 @@ import java.util.Collection;
@Setter
public final class ComputeNodeInstance {
- private final InstanceMetaData instanceMetaData;
+ private final InstanceMetaData metaData;
private final StateContext state = new StateContext();
@@ -67,6 +67,6 @@ public final class ComputeNodeInstance {
* @return current instance id
*/
public String getCurrentInstanceId() {
- return instanceMetaData.getId();
+ return metaData.getId();
}
}
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/InstanceContext.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/InstanceContext.java
index 18d6fbce23f..ea1ff3b46e9 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/InstanceContext.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/InstanceContext.java
@@ -67,7 +67,7 @@ public final class InstanceContext {
* @param status status
*/
public void updateInstanceStatus(final String instanceId, final
Collection<String> status) {
- if (instance.getInstanceMetaData().getId().equals(instanceId)) {
+ if (instance.getMetaData().getId().equals(instanceId)) {
instance.switchState(status);
}
updateRelatedComputeNodeInstancesStatus(instanceId, status);
@@ -75,7 +75,7 @@ public final class InstanceContext {
private void updateRelatedComputeNodeInstancesStatus(final String
instanceId, final Collection<String> status) {
for (ComputeNodeInstance each : computeNodeInstances) {
- if (each.getInstanceMetaData().getId().equals(instanceId)) {
+ if (each.getMetaData().getId().equals(instanceId)) {
each.switchState(status);
}
}
@@ -88,10 +88,10 @@ public final class InstanceContext {
* @param labels collection of label
*/
public void updateLabel(final String instanceId, final Collection<String>
labels) {
- if (instance.getInstanceMetaData().getId().equals(instanceId)) {
+ if (instance.getMetaData().getId().equals(instanceId)) {
instance.setLabels(labels);
}
- computeNodeInstances.stream().filter(each ->
each.getInstanceMetaData().getId().equals(instanceId)).forEach(each ->
each.setLabels(labels));
+ computeNodeInstances.stream().filter(each ->
each.getMetaData().getId().equals(instanceId)).forEach(each ->
each.setLabels(labels));
}
/**
@@ -110,7 +110,7 @@ public final class InstanceContext {
* @param instance compute node instance
*/
public void addComputeNodeInstance(final ComputeNodeInstance instance) {
- computeNodeInstances.removeIf(each ->
each.getInstanceMetaData().getId().equalsIgnoreCase(instance.getInstanceMetaData().getId()));
+ computeNodeInstances.removeIf(each ->
each.getMetaData().getId().equalsIgnoreCase(instance.getMetaData().getId()));
computeNodeInstances.add(instance);
}
@@ -120,7 +120,7 @@ public final class InstanceContext {
* @param instance compute node instance
*/
public void deleteComputeNodeInstance(final ComputeNodeInstance instance) {
- computeNodeInstances.removeIf(each ->
each.getInstanceMetaData().getId().equalsIgnoreCase(instance.getInstanceMetaData().getId()));
+ computeNodeInstances.removeIf(each ->
each.getMetaData().getId().equalsIgnoreCase(instance.getMetaData().getId()));
}
/**
@@ -133,8 +133,8 @@ public final class InstanceContext {
public List<InstanceMetaData> getComputeNodeInstances(final InstanceType
instanceType, final Collection<String> labels) {
List<InstanceMetaData> result = new
ArrayList<>(computeNodeInstances.size());
for (ComputeNodeInstance each : computeNodeInstances) {
- if (each.getInstanceMetaData().getType() == instanceType &&
labels.stream().anyMatch(((Collection<String>) each.getLabels())::contains)) {
- result.add(each.getInstanceMetaData());
+ if (each.getMetaData().getType() == instanceType &&
labels.stream().anyMatch(((Collection<String>) each.getLabels())::contains)) {
+ result.add(each.getMetaData());
}
}
return result;
diff --git
a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactory.java
b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactory.java
index 0c5ab844fa0..1774e9cffd4 100644
---
a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactory.java
+++
b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactory.java
@@ -57,7 +57,7 @@ public final class MetaDataContextsFactory {
*/
public static MetaDataContexts create(final MetaDataPersistService
persistService, final Map<String, DatabaseConfiguration> databaseConfigs,
final InstanceContext
instanceContext) throws SQLException {
- Collection<String> databaseNames =
instanceContext.getInstance().getInstanceMetaData() instanceof
JDBCInstanceMetaData
+ Collection<String> databaseNames =
instanceContext.getInstance().getMetaData() instanceof JDBCInstanceMetaData
? databaseConfigs.keySet()
:
persistService.getDatabaseMetaDataService().loadAllDatabaseNames();
Map<String, DatabaseConfiguration> effectiveDatabaseConfigs =
createEffectiveDatabaseConfigurations(databaseNames, databaseConfigs,
persistService);
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/ClusterContextManagerCoordinator.java
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterContextManagerCoordinator.java
index 3f94c870a57..7965ac0d394 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterContextManagerCoordinator.java
+++
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterContextManagerCoordinator.java
@@ -67,6 +67,7 @@ import java.util.stream.Collectors;
/**
* Cluster context manager coordinator.
*/
+@SuppressWarnings("UnstableApiUsage")
public final class ClusterContextManagerCoordinator {
private final MetaDataPersistService persistService;
@@ -277,7 +278,7 @@ public final class ClusterContextManagerCoordinator {
*/
@Subscribe
public synchronized void triggerShowProcessList(final
ShowProcessListTriggerEvent event) {
- if
(!event.getInstanceId().equals(contextManager.getInstanceContext().getInstance().getInstanceMetaData().getId()))
{
+ if
(!event.getInstanceId().equals(contextManager.getInstanceContext().getInstance().getMetaData().getId()))
{
return;
}
Collection<YamlExecuteProcessContext> processContexts =
ShowProcessListManager.getInstance().getAllProcessContext();
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/RegistryCenter.java
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/RegistryCenter.java
index 2d2151f1593..26259343d21 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/RegistryCenter.java
+++
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/RegistryCenter.java
@@ -78,7 +78,7 @@ public final class RegistryCenter {
* @param computeNodeInstance compute node instance
*/
public void onlineInstance(final ComputeNodeInstance computeNodeInstance) {
-
computeNodeStatusService.registerOnline(computeNodeInstance.getInstanceMetaData());
+
computeNodeStatusService.registerOnline(computeNodeInstance.getMetaData());
computeNodeStatusService.persistInstanceLabels(computeNodeInstance.getCurrentInstanceId(),
computeNodeInstance.getLabels());
listenerFactory.watchListeners();
}
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/lock/manager/internal/ExclusiveInternalLock.java
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/internal/ExclusiveInternalLock.java
index e5dbf653742..301e12af2f4 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/internal/ExclusiveInternalLock.java
+++
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/internal/ExclusiveInternalLock.java
@@ -137,7 +137,7 @@ public final class ExclusiveInternalLock implements
InternalLock, LockAckAble {
return false;
}
for (ComputeNodeInstance each : computeNodeInstances) {
- if (!lockedInstances.contains(each.getInstanceMetaData().getId()))
{
+ if (!lockedInstances.contains(each.getMetaData().getId())) {
return false;
}
}
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/ClusterContextManagerCoordinatorTest.java
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterContextManagerCoordinatorTest.java
index 62fff7ebbe2..bee98ff900a 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterContextManagerCoordinatorTest.java
+++
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterContextManagerCoordinatorTest.java
@@ -290,7 +290,7 @@ public final class ClusterContextManagerCoordinatorTest {
public void assertRenewInstanceStatus() {
Collection<String> testStates = new LinkedList<>();
testStates.add(StateType.OK.name());
- StateEvent mockStateEvent = new
StateEvent(contextManager.getInstanceContext().getInstance().getInstanceMetaData().getId(),
testStates);
+ StateEvent mockStateEvent = new
StateEvent(contextManager.getInstanceContext().getInstance().getMetaData().getId(),
testStates);
coordinator.renew(mockStateEvent);
assertThat(contextManager.getInstanceContext().getInstance().getState().getCurrentState(),
is(StateType.OK));
testStates.add(StateType.CIRCUIT_BREAK.name());
@@ -301,14 +301,14 @@ public final class ClusterContextManagerCoordinatorTest {
@Test
public void assertRenewInstanceLabels() {
Collection<String> labels = Collections.singleton("test");
- coordinator.renew(new
LabelsEvent(contextManager.getInstanceContext().getInstance().getInstanceMetaData().getId(),
labels));
+ coordinator.renew(new
LabelsEvent(contextManager.getInstanceContext().getInstance().getMetaData().getId(),
labels));
assertThat(contextManager.getInstanceContext().getInstance().getLabels(),
is(labels));
}
@Test
public void assertRenewInstanceOfflineEvent() {
- coordinator.renew(new
InstanceOfflineEvent(contextManager.getInstanceContext().getInstance().getInstanceMetaData()));
- assertThat(((ProxyInstanceMetaData)
contextManager.getInstanceContext().getInstance().getInstanceMetaData()).getPort(),
is(3307));
+ coordinator.renew(new
InstanceOfflineEvent(contextManager.getInstanceContext().getInstance().getMetaData()));
+ assertThat(((ProxyInstanceMetaData)
contextManager.getInstanceContext().getInstance().getMetaData()).getPort(),
is(3307));
}
@Test
@@ -330,15 +330,15 @@ public final class ClusterContextManagerCoordinatorTest {
InstanceOnlineEvent instanceOnlineEvent1 = new
InstanceOnlineEvent(instanceMetaData1);
coordinator.renew(instanceOnlineEvent1);
assertThat(contextManager.getInstanceContext().getComputeNodeInstances().size(),
is(1));
- assertThat(((LinkedList<ComputeNodeInstance>)
contextManager.getInstanceContext().getComputeNodeInstances()).get(0).getInstanceMetaData(),
is(instanceMetaData1));
+ assertThat(((LinkedList<ComputeNodeInstance>)
contextManager.getInstanceContext().getComputeNodeInstances()).get(0).getMetaData(),
is(instanceMetaData1));
InstanceMetaData instanceMetaData2 = new
ProxyInstanceMetaData("foo_instance_3308", 3308);
InstanceOnlineEvent instanceOnlineEvent2 = new
InstanceOnlineEvent(instanceMetaData2);
coordinator.renew(instanceOnlineEvent2);
assertThat(contextManager.getInstanceContext().getComputeNodeInstances().size(),
is(2));
- assertThat(((LinkedList<ComputeNodeInstance>)
contextManager.getInstanceContext().getComputeNodeInstances()).get(1).getInstanceMetaData(),
is(instanceMetaData2));
+ assertThat(((LinkedList<ComputeNodeInstance>)
contextManager.getInstanceContext().getComputeNodeInstances()).get(1).getMetaData(),
is(instanceMetaData2));
coordinator.renew(instanceOnlineEvent1);
assertThat(contextManager.getInstanceContext().getComputeNodeInstances().size(),
is(2));
- assertThat(((LinkedList<ComputeNodeInstance>)
contextManager.getInstanceContext().getComputeNodeInstances()).get(1).getInstanceMetaData(),
is(instanceMetaData1));
+ assertThat(((LinkedList<ComputeNodeInstance>)
contextManager.getInstanceContext().getComputeNodeInstances()).get(1).getMetaData(),
is(instanceMetaData1));
}
@Test
@@ -372,7 +372,7 @@ public final class ClusterContextManagerCoordinatorTest {
@Test
public void assertTriggerShowProcessList() throws NoSuchFieldException,
IllegalAccessException {
- String instanceId =
contextManager.getInstanceContext().getInstance().getInstanceMetaData().getId();
+ String instanceId =
contextManager.getInstanceContext().getInstance().getMetaData().getId();
ShowProcessListManager.getInstance().putProcessContext("foo_execution_id", new
YamlExecuteProcessContext(mock(ExecuteProcessContext.class)));
String showProcessListId = "foo_process_id";
coordinator.triggerShowProcessList(new
ShowProcessListTriggerEvent(instanceId, showProcessListId));
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/service/ComputeNodeStatusServiceTest.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/service/ComputeNodeStatusServi
[...]
index f926dec56e7..67f71353a82 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/service/ComputeNodeStatusServiceTest.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/service/ComputeNodeStatusServiceTest.java
@@ -105,19 +105,19 @@ public final class ComputeNodeStatusServiceTest {
when(repository.get("/nodes/compute_nodes/online/proxy/foo_instance_3308")).thenReturn("127.0.0.1@3308");
List<ComputeNodeInstance> actual = new ArrayList<>(new
ComputeNodeStatusService(repository).loadAllComputeNodeInstances());
assertThat(actual.size(), is(2));
- assertThat(actual.get(0).getInstanceMetaData().getId(),
is("foo_instance_3307"));
- assertThat(actual.get(0).getInstanceMetaData().getIp(),
is(IpUtils.getIp()));
- assertThat(actual.get(1).getInstanceMetaData().getId(),
is("foo_instance_3308"));
- assertThat(actual.get(1).getInstanceMetaData().getIp(),
is("127.0.0.1"));
- assertThat(actual.get(1).getInstanceMetaData().getType(),
is(InstanceType.PROXY));
- assertThat(((ProxyInstanceMetaData)
actual.get(1).getInstanceMetaData()).getPort(), is(3308));
+ assertThat(actual.get(0).getMetaData().getId(),
is("foo_instance_3307"));
+ assertThat(actual.get(0).getMetaData().getIp(), is(IpUtils.getIp()));
+ assertThat(actual.get(1).getMetaData().getId(),
is("foo_instance_3308"));
+ assertThat(actual.get(1).getMetaData().getIp(), is("127.0.0.1"));
+ assertThat(actual.get(1).getMetaData().getType(),
is(InstanceType.PROXY));
+ assertThat(((ProxyInstanceMetaData)
actual.get(1).getMetaData()).getPort(), is(3308));
}
@Test
public void assertLoadComputeNodeInstance() {
InstanceMetaData instanceMetaData = new
ProxyInstanceMetaData("foo_instance_id", 3307);
ComputeNodeInstance actual = new
ComputeNodeStatusService(repository).loadComputeNodeInstance(instanceMetaData);
- assertThat(actual.getInstanceMetaData(), is(instanceMetaData));
+ assertThat(actual.getMetaData(), is(instanceMetaData));
}
@Test
diff --git
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-repository/shardingsphere-cluster-mode-repository-provider/shardingsphere-cluster-mode-repository-zookeeper-curator/src/main/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/listener/SessionConnectionListener.java
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-repository/shardingsphere-cluster-mode-reposit
[...]
index cd4b492d3e6..484c4a6767c 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-repository/shardingsphere-cluster-mode-repository-provider/shardingsphere-cluster-mode-repository-zookeeper-curator/src/main/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/listener/SessionConnectionListener.java
+++
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-repository/shardingsphere-cluster-mode-repository-provider/shardingsphere-cluster-mode-repository-zookeeper-curator/src/main/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/listener/SessionConnectionListener.java
@@ -58,7 +58,7 @@ public final class SessionConnectionListener implements
ConnectionStateListener
try {
if (client.getZookeeperClient().blockUntilConnectedOrTimedOut()) {
repository.persistEphemeral(ComputeNode.getOnlineInstanceNodePath(instanceContext.getInstance().getCurrentInstanceId(),
-
instanceContext.getInstance().getInstanceMetaData().getType()),
instanceContext.getInstance().getInstanceMetaData().getAttributes());
+
instanceContext.getInstance().getMetaData().getType()),
instanceContext.getInstance().getMetaData().getAttributes());
return true;
}
sleepInterval();
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/queryable/ShowInstanceHandler.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/queryable/ShowInstanceHandler.java
index 2864ebe707d..771133528ac 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/queryable/ShowInstanceHandler.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/queryable/ShowInstanceHandler.java
@@ -61,13 +61,13 @@ public final class ShowInstanceHandler extends
QueryableRALBackendHandler<ShowIn
return
Collections.singletonList(buildRow(contextManager.getInstanceContext().getInstance(),
modeType));
}
Collection<ComputeNodeInstance> instances =
contextManager.getInstanceContext().getComputeNodeInstances().stream()
- .filter(each -> InstanceType.PROXY ==
each.getInstanceMetaData().getType()).collect(Collectors.toList());
+ .filter(each -> InstanceType.PROXY ==
each.getMetaData().getType()).collect(Collectors.toList());
return instances.isEmpty() ? Collections.emptyList() :
instances.stream().filter(Objects::nonNull).map(each -> buildRow(each,
modeType)).collect(Collectors.toList());
}
private LocalDataQueryResultRow buildRow(final ComputeNodeInstance
instance, final String modeType) {
String labels = null == instance.getLabels() ? "" : String.join(",",
instance.getLabels());
- InstanceMetaData instanceMetaData = instance.getInstanceMetaData();
+ InstanceMetaData instanceMetaData = instance.getMetaData();
return new LocalDataQueryResultRow(instanceMetaData.getId(),
instanceMetaData.getIp(),
instanceMetaData instanceof ProxyInstanceMetaData ?
((ProxyInstanceMetaData) instanceMetaData).getPort() : -1,
instance.getState().getCurrentState().name(), modeType,
labels);
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/queryable/ShowInstanceModeHandler.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/queryable/ShowInstanceModeHandler.java
index 8cf4c09f198..f13a8d7bad8 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/queryable/ShowInstanceModeHandler.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/queryable/ShowInstanceModeHandler.java
@@ -54,7 +54,7 @@ public final class ShowInstanceModeHandler extends
QueryableRALBackendHandler<Sh
protected Collection<LocalDataQueryResultRow> getRows(final ContextManager
contextManager) {
InstanceContext instanceContext =
ProxyContext.getInstance().getContextManager().getInstanceContext();
PersistRepositoryConfiguration repositoryConfig =
instanceContext.getModeConfiguration().getRepository();
- String instanceId =
instanceContext.getInstance().getInstanceMetaData().getId();
+ String instanceId =
instanceContext.getInstance().getMetaData().getId();
String modeType = instanceContext.getModeConfiguration().getType();
String repositoryType = null == repositoryConfig ? "" :
repositoryConfig.getType();
String props = null == repositoryConfig || null ==
repositoryConfig.getProps() ? "" : new
Gson().toJson(repositoryConfig.getProps());
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/queryable/ShowInstanceModeHandlerTest.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/queryable/ShowInstanceModeHandlerTest.java
index 2d323e79f73..aff0e9799c7 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/queryable/ShowInstanceModeHandlerTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/queryable/ShowInstanceModeHandlerTest.java
@@ -59,7 +59,7 @@ public final class ShowInstanceModeHandlerTest extends
ProxyContextRestorer {
private InstanceContext createInstanceContext() {
InstanceContext result = mock(InstanceContext.class,
RETURNS_DEEP_STUBS);
-
when(result.getInstance().getInstanceMetaData().getId()).thenReturn("127.0.0.1@3309");
+
when(result.getInstance().getMetaData().getId()).thenReturn("127.0.0.1@3309");
when(result.getModeConfiguration()).thenReturn(new
ModeConfiguration("Cluster",
new ClusterPersistRepositoryConfiguration("ZooKeeper",
"governance_ds", "127.0.0.1:2181", createProperties("key", "value1,value2")),
false));
return result;