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 8ed5895  Show instance  (#13085)
8ed5895 is described below

commit 8ed5895be032d8e72cc6c5b1fc56eed5e208a98c
Author: lanchengx <[email protected]>
AuthorDate: Sun Oct 17 23:56:55 2021 -0500

    Show instance  (#13085)
    
    * Fixed: exception when starting standalone mode.
    
    * Add todo.
---
 .../distsql/ral/common/show/executor/ShowInstanceExecutor.java | 10 ++++++----
 1 file changed, 6 insertions(+), 4 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 4663504..3d1393d 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
@@ -18,9 +18,9 @@
 package 
org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.show.executor;
 
 import org.apache.shardingsphere.infra.merge.result.MergedResult;
-import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.ClusterInstance;
 import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.ComputeNodeStatus;
 import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.node.ComputeStatusNode;
+import 
org.apache.shardingsphere.mode.manager.cluster.coordinator.utils.IpUtils;
 import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
 import 
org.apache.shardingsphere.proxy.backend.response.header.query.impl.QueryHeader;
@@ -76,9 +76,11 @@ public final class ShowInstanceExecutor extends 
AbstractShowExecutor {
     }
     
     private Collection<List<Object>> buildInstanceRows() {
-        LinkedList<Object> row = new LinkedList<>();
-        row.add(buildRow(ClusterInstance.getInstance().getId(), ENABLE));
-        return Collections.singletonList(row);
+        List<List<Object>> rows = new LinkedList<>();
+        // TODO port is not saved in metadata, add port after saving
+        String instanceId = String.join(DELIMITER, IpUtils.getIp(), " ");
+        rows.add(buildRow(instanceId, ENABLE));
+        return rows;
     }
     
     private Collection<List<Object>> buildInstanceRows(final 
MetaDataPersistService persistService, final String status) {

Reply via email to