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 592ba1a108f Split SHOW INSTANCE MODE. (#19724)
592ba1a108f is described below
commit 592ba1a108f504a9c597a5a2cd4aec8d48fe773e
Author: yx9o <[email protected]>
AuthorDate: Mon Aug 1 10:55:01 2022 +0800
Split SHOW INSTANCE MODE. (#19724)
---
.../src/main/antlr4/imports/Keyword.g4 | 4 ++
.../src/main/antlr4/imports/RALStatement.g4 | 8 ++-
.../parser/autogen/KernelDistSQLStatement.g4 | 3 +-
.../core/kernel/KernelDistSQLStatementVisitor.java | 15 ++++--
...atement.java => ShowInstanceInfoStatement.java} | 4 +-
...deStatement.java => ShowModeInfoStatement.java} | 4 +-
.../distsql/ral/RALBackendHandlerFactory.java | 11 ++--
.../ral/queryable/ShowInstanceInfoHandler.java | 63 ++++++++++++++++++++++
...ceModeHandler.java => ShowModeInfoHandler.java} | 13 ++---
...rTest.java => ShowInstanceInfoHandlerTest.java} | 35 ++++++------
...ndlerTest.java => ShowModeInfoHandlerTest.java} | 19 ++++---
.../ral/impl/QueryableRALStatementAssert.java | 10 ++++
.../queryable/ShowInstanceInfoStatementAssert.java | 46 ++++++++++++++++
.../queryable/ShowModeInfoStatementAssert.java | 46 ++++++++++++++++
.../jaxb/cases/domain/SQLParserTestCases.java | 8 +++
.../ral/ShowInstanceInfoStatementTestCase.java | 8 +--
.../distsql/ral/ShowModeInfoStatementTestCase.java | 8 +--
.../src/main/resources/case/ral/queryable.xml | 2 +
.../main/resources/sql/supported/ral/queryable.xml | 2 +
19 files changed, 249 insertions(+), 60 deletions(-)
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/Keyword.g4
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/Keyword.g4
index f0cb72355fc..f54bff29435 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/Keyword.g4
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/Keyword.g4
@@ -330,3 +330,7 @@ SINGLE_TABLE
SQL_TRANSLATOR
: S Q L UL_ T R A N S L A T O R
;
+
+INFO
+ : I N F O
+ ;
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RALStatement.g4
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RALStatement.g4
index b3f3bfd3988..583025b80c3 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RALStatement.g4
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RALStatement.g4
@@ -79,8 +79,12 @@ alterSQLParserRule
: ALTER SQL_PARSER RULE sqlParserRuleDefinition
;
-showInstanceMode
- : SHOW INSTANCE MODE
+showInstanceInfo
+ : SHOW INSTANCE INFO
+ ;
+
+showModeInfo
+ : SHOW MODE INFO
;
createTrafficRule
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
index 657f2fdef18..fcf85274ac5 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
@@ -32,7 +32,8 @@ execute
| enableInstance
| disableInstance
| showInstance
- | showInstanceMode
+ | showInstanceInfo
+ | showModeInfo
| labelInstance
| unlabelInstance
| countSingleTableRule
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
index e1745233e80..5148116d66c 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
+++
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
@@ -62,7 +62,8 @@ import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementPa
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowAllVariablesContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowAuthorityRuleContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowInstanceContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowInstanceModeContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowInstanceInfoContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowModeInfoContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowResourcesContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowRulesUsedResourceContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowSQLParserRuleContext;
@@ -90,8 +91,9 @@ import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ConvertY
import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ExportDatabaseConfigurationStatement;
import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowAllVariableStatement;
import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowAuthorityRuleStatement;
-import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowInstanceModeStatement;
+import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowInstanceInfoStatement;
import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowInstanceStatement;
+import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowModeInfoStatement;
import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowSQLParserRuleStatement;
import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowSQLTranslatorRuleStatement;
import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowTableMetadataStatement;
@@ -183,8 +185,13 @@ public final class KernelDistSQLStatementVisitor extends
KernelDistSQLStatementB
}
@Override
- public ASTNode visitShowInstanceMode(final ShowInstanceModeContext ctx) {
- return new ShowInstanceModeStatement();
+ public ASTNode visitShowInstanceInfo(final ShowInstanceInfoContext ctx) {
+ return new ShowInstanceInfoStatement();
+ }
+
+ @Override
+ public ASTNode visitShowModeInfo(final ShowModeInfoContext ctx) {
+ return new ShowModeInfoStatement();
}
@Override
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowInstanceModeStatement.java
b/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowInstanceInfoStatement.java
similarity index 91%
copy from
shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowInstanceModeStatement.java
copy to
shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowInstanceInfoStatement.java
index c2376ecf339..d1b56f8e516 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowInstanceModeStatement.java
+++
b/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowInstanceInfoStatement.java
@@ -20,7 +20,7 @@ package
org.apache.shardingsphere.distsql.parser.statement.ral.queryable;
import
org.apache.shardingsphere.distsql.parser.statement.ral.QueryableRALStatement;
/**
- * Show instance mode statement.
+ * Show instance info statement.
*/
-public final class ShowInstanceModeStatement extends QueryableRALStatement {
+public final class ShowInstanceInfoStatement extends QueryableRALStatement {
}
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowInstanceModeStatement.java
b/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowModeInfoStatement.java
similarity index 89%
copy from
shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowInstanceModeStatement.java
copy to
shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowModeInfoStatement.java
index c2376ecf339..9ab759b79e8 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowInstanceModeStatement.java
+++
b/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowModeInfoStatement.java
@@ -20,7 +20,7 @@ package
org.apache.shardingsphere.distsql.parser.statement.ral.queryable;
import
org.apache.shardingsphere.distsql.parser.statement.ral.QueryableRALStatement;
/**
- * Show instance mode statement.
+ * Show mode info statement.
*/
-public final class ShowInstanceModeStatement extends QueryableRALStatement {
+public final class ShowModeInfoStatement extends QueryableRALStatement {
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/RALBackendHandlerFactory.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/RALBackendHandlerFactory.java
index 77cae046793..925477d5d5b 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/RALBackendHandlerFactory.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/RALBackendHandlerFactory.java
@@ -25,8 +25,9 @@ import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ConvertY
import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ExportDatabaseConfigurationStatement;
import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowAllVariableStatement;
import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowAuthorityRuleStatement;
-import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowInstanceModeStatement;
+import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowInstanceInfoStatement;
import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowInstanceStatement;
+import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowModeInfoStatement;
import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowSQLParserRuleStatement;
import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowSQLTranslatorRuleStatement;
import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowTableMetadataStatement;
@@ -49,7 +50,6 @@ import
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.RefreshT
import
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.SetInstanceStatusStatement;
import
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.SetVariableStatement;
import
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.UnlabelInstanceStatement;
-import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.backend.handler.ProxyBackendHandler;
import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.hint.HintRALBackendHandler;
import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ConvertYamlConfigurationHandler;
@@ -57,7 +57,8 @@ import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.Exp
import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowAllVariableHandler;
import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowAuthorityRuleHandler;
import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowInstanceHandler;
-import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowInstanceModeHandler;
+import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowInstanceInfoHandler;
+import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowModeInfoHandler;
import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowReadwriteSplittingReadResourcesHandler;
import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowSQLParserRuleHandler;
import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowSQLTranslatorRuleHandler;
@@ -83,6 +84,7 @@ import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.Set
import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.SetReadwriteSplittingStatusHandler;
import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.SetVariableHandler;
import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.UnlabelInstanceHandler;
+import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import
org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.ShowReadwriteSplittingReadResourcesStatement;
import
org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.status.SetReadwriteSplittingStatusStatement;
@@ -115,7 +117,6 @@ public final class RALBackendHandlerFactory {
HANDLERS.put(DiscardDistSQLStatement.class,
DiscardDistSQLHandler.class);
HANDLERS.put(ImportDatabaseConfigurationStatement.class,
ImportDatabaseConfigurationHandler.class);
HANDLERS.put(ShowInstanceStatement.class, ShowInstanceHandler.class);
- HANDLERS.put(ShowInstanceModeStatement.class,
ShowInstanceModeHandler.class);
HANDLERS.put(ShowVariableStatement.class, ShowVariableHandler.class);
HANDLERS.put(ShowAllVariableStatement.class,
ShowAllVariableHandler.class);
HANDLERS.put(ShowReadwriteSplittingReadResourcesStatement.class,
ShowReadwriteSplittingReadResourcesHandler.class);
@@ -127,6 +128,8 @@ public final class RALBackendHandlerFactory {
HANDLERS.put(ExportDatabaseConfigurationStatement.class,
ExportDatabaseConfigurationHandler.class);
HANDLERS.put(ConvertYamlConfigurationStatement.class,
ConvertYamlConfigurationHandler.class);
HANDLERS.put(ShowSQLTranslatorRuleStatement.class,
ShowSQLTranslatorRuleHandler.class);
+ HANDLERS.put(ShowInstanceInfoStatement.class,
ShowInstanceInfoHandler.class);
+ HANDLERS.put(ShowModeInfoStatement.class, ShowModeInfoHandler.class);
}
/**
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowInstanceInfoHandler.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowInstanceInfoHandler.java
new file mode 100644
index 00000000000..c3ddd18f46b
--- /dev/null
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowInstanceInfoHandler.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable;
+
+import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowInstanceInfoStatement;
+import org.apache.shardingsphere.infra.instance.ComputeNodeInstance;
+import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
+import
org.apache.shardingsphere.infra.instance.metadata.proxy.ProxyInstanceMetaData;
+import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
+import org.apache.shardingsphere.mode.manager.ContextManager;
+import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.QueryableRALBackendHandler;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * Show instance info handler.
+ */
+public final class ShowInstanceInfoHandler extends
QueryableRALBackendHandler<ShowInstanceInfoStatement> {
+
+ private static final String ID = "instance_id";
+
+ private static final String HOST = "host";
+
+ private static final String PORT = "port";
+
+ private static final String STATUS = "status";
+
+ private static final String MODE_TYPE = "mode_type";
+
+ private static final String LABELS = "labels";
+
+ @Override
+ protected Collection<String> getColumnNames() {
+ return Arrays.asList(ID, HOST, PORT, STATUS, MODE_TYPE, LABELS);
+ }
+
+ @Override
+ protected Collection<LocalDataQueryResultRow> getRows(final ContextManager
contextManager) {
+ ComputeNodeInstance instance =
contextManager.getInstanceContext().getInstance();
+ InstanceMetaData instanceMetaData = instance.getMetaData();
+ String modeType =
contextManager.getInstanceContext().getModeConfiguration().getType();
+ return Collections.singletonList(new
LocalDataQueryResultRow(instanceMetaData.getId(), instanceMetaData.getIp(),
+ instanceMetaData instanceof ProxyInstanceMetaData ?
((ProxyInstanceMetaData) instanceMetaData).getPort() : -1,
+ instance.getState().getCurrentState().name(), modeType,
String.join(",", instance.getLabels())));
+ }
+}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowInstanceModeHandler.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowModeInfoHandler.java
similarity index 85%
rename from
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowInstanceModeHandler.java
rename to
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowModeInfoHandler.java
index 65051a89b97..8498b3db2fc 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowInstanceModeHandler.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowModeInfoHandler.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable;
import com.google.gson.Gson;
-import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowInstanceModeStatement;
+import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowModeInfoStatement;
import
org.apache.shardingsphere.infra.config.mode.PersistRepositoryConfiguration;
import org.apache.shardingsphere.infra.instance.InstanceContext;
import
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
@@ -31,11 +31,9 @@ import java.util.Collection;
import java.util.Collections;
/**
- * Show instance mode handler.
+ * Show mode info handler.
*/
-public final class ShowInstanceModeHandler extends
QueryableRALBackendHandler<ShowInstanceModeStatement> {
-
- private static final String INSTANCE_ID = "instance_id";
+public final class ShowModeInfoHandler extends
QueryableRALBackendHandler<ShowModeInfoStatement> {
private static final String TYPE = "type";
@@ -47,18 +45,17 @@ public final class ShowInstanceModeHandler extends
QueryableRALBackendHandler<Sh
@Override
protected Collection<String> getColumnNames() {
- return Arrays.asList(INSTANCE_ID, TYPE, REPOSITORY, PROPS, OVERWRITE);
+ return Arrays.asList(TYPE, REPOSITORY, PROPS, OVERWRITE);
}
@Override
protected Collection<LocalDataQueryResultRow> getRows(final ContextManager
contextManager) {
InstanceContext instanceContext =
ProxyContext.getInstance().getContextManager().getInstanceContext();
PersistRepositoryConfiguration repositoryConfig =
instanceContext.getModeConfiguration().getRepository();
- 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());
String overwrite =
String.valueOf(instanceContext.getModeConfiguration().isOverwrite());
- return Collections.singleton(new LocalDataQueryResultRow(instanceId,
modeType, repositoryType, props, overwrite));
+ return Collections.singleton(new LocalDataQueryResultRow(modeType,
repositoryType, props, overwrite));
}
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowInstanceModeHandlerTest.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowInstanceInfoHandlerTest.java
similarity index 69%
copy from
shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowInstanceModeHandlerTest.java
copy to
shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowInstanceInfoHandlerTest.java
index 749dcda8263..3c321ba0737 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowInstanceModeHandlerTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowInstanceInfoHandlerTest.java
@@ -17,11 +17,13 @@
package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable;
-import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowInstanceModeStatement;
+import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowInstanceInfoStatement;
import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
import org.apache.shardingsphere.infra.instance.InstanceContext;
+import
org.apache.shardingsphere.infra.instance.metadata.proxy.ProxyInstanceMetaData;
+import org.apache.shardingsphere.infra.state.StateContext;
import org.apache.shardingsphere.mode.manager.ContextManager;
-import
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryConfiguration;
+import
org.apache.shardingsphere.mode.repository.standalone.StandalonePersistRepositoryConfiguration;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
import org.junit.Test;
@@ -36,38 +38,33 @@ import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-public final class ShowInstanceModeHandlerTest extends ProxyContextRestorer {
+public final class ShowInstanceInfoHandlerTest extends ProxyContextRestorer {
@Test
public void assertExecutor() throws SQLException {
ContextManager contextManager = mock(ContextManager.class,
RETURNS_DEEP_STUBS);
InstanceContext instanceContext = createInstanceContext();
when(contextManager.getInstanceContext()).thenReturn(instanceContext);
- ShowInstanceModeHandler handler = new ShowInstanceModeHandler();
- handler.init(new ShowInstanceModeStatement(), null);
+ ShowInstanceInfoHandler handler = new ShowInstanceInfoHandler();
+ handler.init(new ShowInstanceInfoStatement(), null);
ProxyContext.init(contextManager);
handler.execute();
handler.next();
List<Object> data = handler.getRowData().getData();
- assertThat(data.size(), is(5));
+ assertThat(data.size(), is(6));
assertThat(data.get(0), is("127.0.0.1@3309"));
- assertThat(data.get(1), is("Cluster"));
- assertThat(data.get(2), is("ZooKeeper"));
- assertThat(data.get(3), is("{\"key\":\"value1,value2\"}"));
- assertThat(data.get(4), is(Boolean.FALSE.toString()));
+ assertThat(data.get(1), is("127.0.0.1"));
+ assertThat(data.get(2), is(3309));
+ assertThat(data.get(3), is("OK"));
+ assertThat(data.get(4), is("Standalone"));
+ assertThat(data.get(5), is(""));
}
private InstanceContext createInstanceContext() {
InstanceContext result = mock(InstanceContext.class,
RETURNS_DEEP_STUBS);
-
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;
- }
-
- private Properties createProperties(final String key, final String value) {
- Properties result = new Properties();
- result.put(key, value);
+ when(result.getInstance().getMetaData()).thenReturn(new
ProxyInstanceMetaData("127.0.0.1@3309", "127.0.0.1@3309"));
+ when(result.getInstance().getState()).thenReturn(new StateContext());
+ when(result.getModeConfiguration()).thenReturn(new
ModeConfiguration("Standalone", new
StandalonePersistRepositoryConfiguration("H2", new Properties()), true));
return result;
}
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowInstanceModeHandlerTest.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowModeInfoHandlerTest.java
similarity index 83%
rename from
shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowInstanceModeHandlerTest.java
rename to
shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowModeInfoHandlerTest.java
index 749dcda8263..ccf1ee00f2a 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowInstanceModeHandlerTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowModeInfoHandlerTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable;
-import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowInstanceModeStatement;
+import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowModeInfoStatement;
import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
import org.apache.shardingsphere.infra.instance.InstanceContext;
import org.apache.shardingsphere.mode.manager.ContextManager;
@@ -36,25 +36,24 @@ import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-public final class ShowInstanceModeHandlerTest extends ProxyContextRestorer {
+public final class ShowModeInfoHandlerTest extends ProxyContextRestorer {
@Test
public void assertExecutor() throws SQLException {
ContextManager contextManager = mock(ContextManager.class,
RETURNS_DEEP_STUBS);
InstanceContext instanceContext = createInstanceContext();
when(contextManager.getInstanceContext()).thenReturn(instanceContext);
- ShowInstanceModeHandler handler = new ShowInstanceModeHandler();
- handler.init(new ShowInstanceModeStatement(), null);
+ ShowModeInfoHandler handler = new ShowModeInfoHandler();
+ handler.init(new ShowModeInfoStatement(), null);
ProxyContext.init(contextManager);
handler.execute();
handler.next();
List<Object> data = handler.getRowData().getData();
- assertThat(data.size(), is(5));
- assertThat(data.get(0), is("127.0.0.1@3309"));
- assertThat(data.get(1), is("Cluster"));
- assertThat(data.get(2), is("ZooKeeper"));
- assertThat(data.get(3), is("{\"key\":\"value1,value2\"}"));
- assertThat(data.get(4), is(Boolean.FALSE.toString()));
+ assertThat(data.size(), is(4));
+ assertThat(data.get(0), is("Cluster"));
+ assertThat(data.get(1), is("ZooKeeper"));
+ assertThat(data.get(2), is("{\"key\":\"value1,value2\"}"));
+ assertThat(data.get(3), is(Boolean.FALSE.toString()));
}
private InstanceContext createInstanceContext() {
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/QueryableRALStatementAssert.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/QueryableRALStatementAssert.java
index 30a1c1a6219..7a6971a1349 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/QueryableRALStatementAssert.java
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/QueryableRALStatementAssert.java
@@ -23,7 +23,9 @@ import
org.apache.shardingsphere.distsql.parser.statement.ral.QueryableRALStatem
import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ExportDatabaseConfigurationStatement;
import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowAllVariableStatement;
import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowAuthorityRuleStatement;
+import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowInstanceInfoStatement;
import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowInstanceStatement;
+import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowModeInfoStatement;
import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowSQLParserRuleStatement;
import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowSQLTranslatorRuleStatement;
import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowTableMetadataStatement;
@@ -35,7 +37,9 @@ import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAs
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.queryable.ExportDatabaseConfigurationStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.queryable.ShowAllVariableStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.queryable.ShowAuthorityRuleStatementAssert;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.queryable.ShowInstanceInfoStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.queryable.ShowInstanceStatementAssert;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.queryable.ShowModeInfoStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.queryable.ShowReadwriteSplittingReadResourcesStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.queryable.ShowSQLParserRuleStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.queryable.ShowSQLTranslatorRuleStatementAssert;
@@ -47,7 +51,9 @@ import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ExportDatabaseConfigurationStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowAllVariableStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowAuthorityRuleStatementTestCase;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowInstanceInfoStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowInstanceStatementTestCase;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowModeInfoStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowReadwriteSplittingReadResourcesStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowSQLParserRuleStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowSQLTranslatorRuleStatementTestCase;
@@ -93,6 +99,10 @@ public final class QueryableRALStatementAssert {
ExportDatabaseConfigurationStatementAssert.assertIs(assertContext,
(ExportDatabaseConfigurationStatement) actual,
(ExportDatabaseConfigurationStatementTestCase) expected);
} else if (actual instanceof ShowSQLTranslatorRuleStatement) {
ShowSQLTranslatorRuleStatementAssert.assertIs(assertContext,
(ShowSQLTranslatorRuleStatement) actual,
(ShowSQLTranslatorRuleStatementTestCase) expected);
+ } else if (actual instanceof ShowInstanceInfoStatement) {
+ ShowInstanceInfoStatementAssert.assertIs(assertContext,
(ShowInstanceInfoStatement) actual, (ShowInstanceInfoStatementTestCase)
expected);
+ } else if (actual instanceof ShowModeInfoStatement) {
+ ShowModeInfoStatementAssert.assertIs(assertContext,
(ShowModeInfoStatement) actual, (ShowModeInfoStatementTestCase) expected);
}
}
}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/queryable/ShowInstanceInfoStatementAssert.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/queryable/ShowInstanceInfoStatementAssert.java
new file mode 100644
index 00000000000..7e559e6ad2c
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/queryable/ShowInstanceInfoStatementAssert.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.queryable;
+
+import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowInstanceInfoStatement;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowInstanceInfoStatementTestCase;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+/**
+ * Show instance info statement assert.
+ */
+public final class ShowInstanceInfoStatementAssert {
+
+ /**
+ * Assert show instance info statement is correct with expected parser
result.
+ *
+ * @param assertContext assert context
+ * @param actual actual show instance info statement
+ * @param expected expected show instance info statement test case
+ */
+ public static void assertIs(final SQLCaseAssertContext assertContext,
final ShowInstanceInfoStatement actual, final ShowInstanceInfoStatementTestCase
expected) {
+ if (null == expected) {
+ assertNull(assertContext.getText("Actual statement should not
exist."), actual);
+ } else {
+ assertNotNull(assertContext.getText("Actual statement should
exist."), actual);
+ }
+ }
+}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/queryable/ShowModeInfoStatementAssert.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/queryable/ShowModeInfoStatementAssert.java
new file mode 100644
index 00000000000..8580ee72dfd
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/queryable/ShowModeInfoStatementAssert.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.ral.impl.queryable;
+
+import
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowModeInfoStatement;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowModeInfoStatementTestCase;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+/**
+ * Show mode info statement assert.
+ */
+public final class ShowModeInfoStatementAssert {
+
+ /**
+ * Assert show mode info statement is correct with expected parser result.
+ *
+ * @param assertContext assert context
+ * @param actual actual show mode info statement
+ * @param expected expected show mode info statement test case
+ */
+ public static void assertIs(final SQLCaseAssertContext assertContext,
final ShowModeInfoStatement actual, final ShowModeInfoStatementTestCase
expected) {
+ if (null == expected) {
+ assertNull(assertContext.getText("Actual statement should not
exist."), actual);
+ } else {
+ assertNotNull(assertContext.getText("Actual statement should
exist."), actual);
+ }
+ }
+}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
index e8c1ba95e2d..e1f7bf3a4ce 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
@@ -286,7 +286,9 @@ import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.SetVariableStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowAllVariableStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowAuthorityRuleStatementTestCase;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowInstanceInfoStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowInstanceStatementTestCase;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowModeInfoStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowReadwriteSplittingHintStatusStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowReadwriteSplittingReadResourcesStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowSQLParserRuleStatementTestCase;
@@ -1627,6 +1629,12 @@ public final class SQLParserTestCases {
@XmlElement(name = "create-foreign-table")
private final List<CreateForeignTableStatementTestCase>
createForeignTableStatementTestCases = new LinkedList<>();
+ @XmlElement(name = "show-instance-info")
+ private final List<ShowInstanceInfoStatementTestCase>
showInstanceInfoStatementTestCases = new LinkedList<>();
+
+ @XmlElement(name = "show-mode-info")
+ private final List<ShowModeInfoStatementTestCase>
showModeInfoStatementTestCases = new LinkedList<>();
+
/**
* Get all SQL parser test cases.
*
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowInstanceModeStatement.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/ShowInstanceInfoStatementTestCase.java
similarity index 70%
copy from
shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowInstanceModeStatement.java
copy to
shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/ShowInstanceInfoStatementTestCase.java
index c2376ecf339..4433d597805 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowInstanceModeStatement.java
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/ShowInstanceInfoStatementTestCase.java
@@ -15,12 +15,12 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.distsql.parser.statement.ral.queryable;
+package
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral;
-import
org.apache.shardingsphere.distsql.parser.statement.ral.QueryableRALStatement;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
/**
- * Show instance mode statement.
+ * Show instance info statement test case.
*/
-public final class ShowInstanceModeStatement extends QueryableRALStatement {
+public final class ShowInstanceInfoStatementTestCase extends SQLParserTestCase
{
}
diff --git
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowInstanceModeStatement.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/ShowModeInfoStatementTestCase.java
similarity index 71%
rename from
shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowInstanceModeStatement.java
rename to
shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/ShowModeInfoStatementTestCase.java
index c2376ecf339..9bcbc9fd21f 100644
---
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowInstanceModeStatement.java
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/ral/ShowModeInfoStatementTestCase.java
@@ -15,12 +15,12 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.distsql.parser.statement.ral.queryable;
+package
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral;
-import
org.apache.shardingsphere.distsql.parser.statement.ral.QueryableRALStatement;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
/**
- * Show instance mode statement.
+ * Show mode info statement test case.
*/
-public final class ShowInstanceModeStatement extends QueryableRALStatement {
+public final class ShowModeInfoStatementTestCase extends SQLParserTestCase {
}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/queryable.xml
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/queryable.xml
index 9a55187ef63..b8931dfdeb2 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/queryable.xml
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ral/queryable.xml
@@ -34,6 +34,8 @@
<show-sql-parser-rule sql-case-id="show-sql-parser-rule" />
<show-traffic-rules sql-case-id="show-traffic-rules" rule-name="rule_name"
/>
<show-sql-translator-rule sql-case-id="show-sql-translator-rule" />
+ <show-instance-info sql-case-id="show-instance-info" />
+ <show-mode-info sql-case-id="show-mode-info" />
<export-database-config sql-case-id="export-database-config">
<database name="database_name" start-index="28" stop-index="40" />
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/queryable.xml
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/queryable.xml
index 39d68939902..17cbdbcaa69 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/queryable.xml
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ral/queryable.xml
@@ -31,6 +31,8 @@
<distsql-case id="show-sql-parser-rule" value="SHOW SQL_PARSER RULE" />
<distsql-case id="show-traffic-rules" value="SHOW TRAFFIC RULE rule_name"
/>
<distsql-case id="show-sql-translator-rule" value="SHOW SQL_TRANSLATOR
RULE" />
+ <distsql-case id="show-instance-info" value="SHOW INSTANCE INFO" />
+ <distsql-case id="show-mode-info" value="SHOW MODE INFO" />
<distsql-case id="export-database-config" value="EXPORT DATABASE CONFIG
FROM database_name" />
</sql-cases>