You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ji...@apache.org on 2022/01/20 05:31:14 UTC

[shardingsphere] branch master updated: Adjust the display of the `Show instance list` statement in stand-alone mode. (#14930)

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 0d48210   Adjust the display of the `Show instance list` statement in stand-alone mode. (#14930)
0d48210 is described below

commit 0d48210234657be65393e31de68c0a1a7d55bd4c
Author: lanchengx <52...@users.noreply.github.com>
AuthorDate: Thu Jan 20 13:30:11 2022 +0800

     Adjust the display of the `Show instance list` statement in stand-alone mode. (#14930)
---
 .../text/distsql/ral/common/show/executor/ShowInstanceExecutor.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

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 cec8a3b..65b195f 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
@@ -22,6 +22,7 @@ import org.apache.shardingsphere.infra.instance.definition.InstanceId;
 import org.apache.shardingsphere.infra.merge.result.MergedResult;
 import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.ComputeNodeStatus;
 import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
+import org.apache.shardingsphere.mode.repository.standalone.StandalonePersistRepository;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
 import org.apache.shardingsphere.proxy.backend.response.header.query.impl.QueryHeader;
 import org.apache.shardingsphere.sharding.merge.dal.common.MultipleLocalDataMergedResult;
@@ -68,7 +69,7 @@ public final class ShowInstanceExecutor extends AbstractShowExecutor {
     @Override
     protected MergedResult createMergedResult() {
         MetaDataPersistService persistService = ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaDataPersistService().orElse(null);
-        if (null == persistService || null == persistService.getRepository()) {
+        if (null == persistService || null == persistService.getRepository() || persistService.getRepository() instanceof StandalonePersistRepository) {
             return new MultipleLocalDataMergedResult(buildInstanceRows());
         }
         return new MultipleLocalDataMergedResult(buildInstanceRows(persistService));
@@ -76,7 +77,7 @@ public final class ShowInstanceExecutor extends AbstractShowExecutor {
     
     private Collection<List<Object>> buildInstanceRows() {
         List<List<Object>> rows = new LinkedList<>();
-        InstanceId instanceId = new InstanceId();
+        InstanceId instanceId = ProxyContext.getInstance().getContextManager().getInstanceContext().getInstance().getInstanceDefinition().getInstanceId();
         rows.add(buildRow(instanceId.getId(), ENABLE));
         return rows;
     }