You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by wu...@apache.org on 2024/02/11 14:35:20 UTC
(shardingsphere) branch master updated: Use ShowMigrationCheckAlgorithmPluginsResultRowBuilder instead of ShowMigrationCheckAlgorithmsExecutor (#30092)
This is an automated email from the ASF dual-hosted git repository.
wuweijie 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 53e1b26567b Use ShowMigrationCheckAlgorithmPluginsResultRowBuilder instead of ShowMigrationCheckAlgorithmsExecutor (#30092)
53e1b26567b is described below
commit 53e1b26567ba8eaf09ff29daedf6ffdafebdd54f
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sun Feb 11 22:35:14 2024 +0800
Use ShowMigrationCheckAlgorithmPluginsResultRowBuilder instead of ShowMigrationCheckAlgorithmsExecutor (#30092)
---
...tionCheckAlgorithmPluginsResultRowBuilder.java} | 19 +++++++--
.../ShowMigrationCheckAlgorithmsExecutor.java | 49 ----------------------
...stsql.handler.engine.query.DistSQLQueryExecutor | 1 -
...xecutor.ral.plugin.ShowPluginsResultRowBuilder} | 9 +---
.../core/MigrationDistSQLStatementVisitor.java | 36 ++++++++--------
.../QueryablePipelineRALStatementAssert.java | 5 +--
6 files changed, 35 insertions(+), 84 deletions(-)
diff --git a/kernel/data-pipeline/distsql/statement/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/statement/ShowMigrationCheckAlgorithmsStatement.java b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationCheckAlgorithmPluginsResultRowBuilder.java
similarity index 58%
rename from kernel/data-pipeline/distsql/statement/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/statement/ShowMigrationCheckAlgorithmsStatement.java
rename to kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationCheckAlgorithmPluginsResultRowBuilder.java
index 32c22537271..7618f4ee8cd 100644
--- a/kernel/data-pipeline/distsql/statement/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/statement/ShowMigrationCheckAlgorithmsStatement.java
+++ b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationCheckAlgorithmPluginsResultRowBuilder.java
@@ -15,12 +15,23 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.data.pipeline.migration.distsql.statement;
+package org.apache.shardingsphere.data.pipeline.migration.distsql.handler.query;
-import org.apache.shardingsphere.distsql.statement.ral.pipeline.migration.QueryableMigrationRALStatement;
+import org.apache.shardingsphere.data.pipeline.core.consistencycheck.table.TableDataConsistencyChecker;
+import org.apache.shardingsphere.distsql.handler.executor.ral.plugin.ShowPluginsResultRowBuilder;
/**
- * Show migration check algorithms statement.
+ * Show migration check algorithm plugins result row builder.
*/
-public final class ShowMigrationCheckAlgorithmsStatement extends QueryableMigrationRALStatement {
+public final class ShowMigrationCheckAlgorithmPluginsResultRowBuilder implements ShowPluginsResultRowBuilder {
+
+ @Override
+ public Class<TableDataConsistencyChecker> getPluginClass() {
+ return TableDataConsistencyChecker.class;
+ }
+
+ @Override
+ public String getType() {
+ return "MIGRATION_CHECK";
+ }
}
diff --git a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationCheckAlgorithmsExecutor.java b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationCheckAlgorithmsExecutor.java
deleted file mode 100644
index e4c5fd03916..00000000000
--- a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/handler/query/ShowMigrationCheckAlgorithmsExecutor.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.data.pipeline.migration.distsql.handler.query;
-
-import org.apache.shardingsphere.data.pipeline.core.consistencycheck.table.TableDataConsistencyChecker;
-import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.ShowMigrationCheckAlgorithmsStatement;
-import org.apache.shardingsphere.distsql.handler.engine.query.DistSQLQueryExecutor;
-import org.apache.shardingsphere.distsql.handler.engine.query.ral.plugin.PluginMetaDataQueryResultRows;
-import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
-import org.apache.shardingsphere.mode.manager.ContextManager;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-/**
- * Show migration check algorithms' executor.
- */
-public final class ShowMigrationCheckAlgorithmsExecutor implements DistSQLQueryExecutor<ShowMigrationCheckAlgorithmsStatement> {
-
- @Override
- public Collection<String> getColumnNames(final ShowMigrationCheckAlgorithmsStatement sqlStatement) {
- return Arrays.asList("type", "type_aliases", "supported_database_types", "description");
- }
-
- @Override
- public Collection<LocalDataQueryResultRow> getRows(final ShowMigrationCheckAlgorithmsStatement sqlStatement, final ContextManager contextManager) {
- return new PluginMetaDataQueryResultRows(TableDataConsistencyChecker.class).getRows();
- }
-
- @Override
- public Class<ShowMigrationCheckAlgorithmsStatement> getType() {
- return ShowMigrationCheckAlgorithmsStatement.class;
- }
-}
diff --git a/kernel/data-pipeline/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.engine.query.DistSQLQueryExecutor b/kernel/data-pipeline/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.engine.query.DistSQLQueryExecutor
index 98eae04f44a..a9920b3bf35 100644
--- a/kernel/data-pipeline/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.engine.query.DistSQLQueryExecutor
+++ b/kernel/data-pipeline/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.engine.query.DistSQLQueryExecutor
@@ -19,7 +19,6 @@ org.apache.shardingsphere.data.pipeline.migration.distsql.handler.query.ShowMigr
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.query.ShowMigrationJobStatusExecutor
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.query.ShowMigrationCheckStatusExecutor
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.query.ShowMigrationSourceStorageUnitsExecutor
-org.apache.shardingsphere.data.pipeline.migration.distsql.handler.query.ShowMigrationCheckAlgorithmsExecutor
org.apache.shardingsphere.data.pipeline.cdc.distsql.handler.query.ShowStreamingListExecutor
org.apache.shardingsphere.data.pipeline.cdc.distsql.handler.query.ShowStreamingJobStatusExecutor
org.apache.shardingsphere.data.pipeline.cdc.distsql.handler.query.ShowStreamingRuleExecutor
diff --git a/kernel/data-pipeline/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.engine.query.DistSQLQueryExecutor b/kernel/data-pipeline/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.executor.ral.plugin.ShowPluginsResultRowBuilder
similarity index 53%
copy from kernel/data-pipeline/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.engine.query.DistSQLQueryExecutor
copy to kernel/data-pipeline/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.executor.ral.plugin.ShowPluginsResultRowBuilder
index 98eae04f44a..bae705f3938 100644
--- a/kernel/data-pipeline/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.engine.query.DistSQLQueryExecutor
+++ b/kernel/data-pipeline/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.executor.ral.plugin.ShowPluginsResultRowBuilder
@@ -15,11 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.data.pipeline.migration.distsql.handler.query.ShowMigrationListExecutor
-org.apache.shardingsphere.data.pipeline.migration.distsql.handler.query.ShowMigrationJobStatusExecutor
-org.apache.shardingsphere.data.pipeline.migration.distsql.handler.query.ShowMigrationCheckStatusExecutor
-org.apache.shardingsphere.data.pipeline.migration.distsql.handler.query.ShowMigrationSourceStorageUnitsExecutor
-org.apache.shardingsphere.data.pipeline.migration.distsql.handler.query.ShowMigrationCheckAlgorithmsExecutor
-org.apache.shardingsphere.data.pipeline.cdc.distsql.handler.query.ShowStreamingListExecutor
-org.apache.shardingsphere.data.pipeline.cdc.distsql.handler.query.ShowStreamingJobStatusExecutor
-org.apache.shardingsphere.data.pipeline.cdc.distsql.handler.query.ShowStreamingRuleExecutor
+org.apache.shardingsphere.data.pipeline.migration.distsql.handler.query.ShowMigrationCheckAlgorithmPluginsResultRowBuilder
diff --git a/kernel/data-pipeline/distsql/parser/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/parser/core/MigrationDistSQLStatementVisitor.java b/kernel/data-pipeline/distsql/parser/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/parser/core/MigrationDistSQLStatementVisitor.java
index 7502a5d6a16..754b6cd4d90 100644
--- a/kernel/data-pipeline/distsql/parser/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/parser/core/MigrationDistSQLStatementVisitor.java
+++ b/kernel/data-pipeline/distsql/parser/src/main/java/org/apache/shardingsphere/data/pipeline/migration/distsql/parser/core/MigrationDistSQLStatementVisitor.java
@@ -19,6 +19,22 @@ package org.apache.shardingsphere.data.pipeline.migration.distsql.parser.core;
import com.google.common.base.Splitter;
import org.antlr.v4.runtime.tree.ParseTree;
+import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.CheckMigrationStatement;
+import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.CommitMigrationStatement;
+import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.DropMigrationCheckStatement;
+import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.MigrateTableStatement;
+import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.RegisterMigrationSourceStorageUnitStatement;
+import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.RollbackMigrationStatement;
+import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.ShowMigrationCheckStatusStatement;
+import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.ShowMigrationListStatement;
+import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.ShowMigrationSourceStorageUnitsStatement;
+import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.ShowMigrationStatusStatement;
+import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.StartMigrationCheckStatement;
+import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.StartMigrationStatement;
+import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.StopMigrationCheckStatement;
+import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.StopMigrationStatement;
+import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.UnregisterMigrationSourceStorageUnitStatement;
+import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.pojo.SourceTargetEntry;
import org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementBaseVisitor;
import org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser;
import org.apache.shardingsphere.distsql.parser.autogen.MigrationDistSQLStatementParser.AlgorithmDefinitionContext;
@@ -48,24 +64,8 @@ import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
import org.apache.shardingsphere.distsql.segment.DataSourceSegment;
import org.apache.shardingsphere.distsql.segment.HostnameAndPortBasedDataSourceSegment;
import org.apache.shardingsphere.distsql.segment.URLBasedDataSourceSegment;
+import org.apache.shardingsphere.distsql.statement.ral.queryable.show.ShowPluginsStatement;
import org.apache.shardingsphere.infra.datanode.DataNode;
-import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.CheckMigrationStatement;
-import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.CommitMigrationStatement;
-import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.DropMigrationCheckStatement;
-import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.MigrateTableStatement;
-import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.RegisterMigrationSourceStorageUnitStatement;
-import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.RollbackMigrationStatement;
-import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.ShowMigrationCheckAlgorithmsStatement;
-import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.ShowMigrationCheckStatusStatement;
-import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.ShowMigrationListStatement;
-import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.ShowMigrationSourceStorageUnitsStatement;
-import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.ShowMigrationStatusStatement;
-import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.StartMigrationCheckStatement;
-import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.StartMigrationStatement;
-import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.StopMigrationCheckStatement;
-import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.StopMigrationStatement;
-import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.UnregisterMigrationSourceStorageUnitStatement;
-import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.pojo.SourceTargetEntry;
import org.apache.shardingsphere.sql.parser.api.ASTNode;
import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
import org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
@@ -142,7 +142,7 @@ public final class MigrationDistSQLStatementVisitor extends MigrationDistSQLStat
@Override
public ASTNode visitShowMigrationCheckAlgorithms(final ShowMigrationCheckAlgorithmsContext ctx) {
- return new ShowMigrationCheckAlgorithmsStatement();
+ return new ShowPluginsStatement("MIGRATION_CHECK");
}
@Override
diff --git a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/pipeline/QueryablePipelineRALStatementAssert.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/pipeline/QueryablePipelineRALStatementAssert.java
index e33572bac85..ac76f692b7f 100644
--- a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/pipeline/QueryablePipelineRALStatementAssert.java
+++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ral/impl/pipeline/QueryablePipelineRALStatementAssert.java
@@ -22,12 +22,11 @@ import lombok.NoArgsConstructor;
import org.apache.shardingsphere.data.pipeline.cdc.distsql.statement.ShowStreamingListStatement;
import org.apache.shardingsphere.data.pipeline.cdc.distsql.statement.ShowStreamingRuleStatement;
import org.apache.shardingsphere.data.pipeline.cdc.distsql.statement.ShowStreamingStatusStatement;
-import org.apache.shardingsphere.distsql.statement.ral.pipeline.QueryablePipelineRALStatement;
-import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.ShowMigrationCheckAlgorithmsStatement;
import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.ShowMigrationCheckStatusStatement;
import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.ShowMigrationListStatement;
import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.ShowMigrationSourceStorageUnitsStatement;
import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.ShowMigrationStatusStatement;
+import org.apache.shardingsphere.distsql.statement.ral.pipeline.QueryablePipelineRALStatement;
import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext;
import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ExistingAssert;
import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.pipeline.cdc.ShowStreamingStatusStatementAssert;
@@ -55,8 +54,6 @@ public final class QueryablePipelineRALStatementAssert {
// TODO add more test case
if (actual instanceof ShowMigrationListStatement) {
ExistingAssert.assertIs(assertContext, actual, expected);
- } else if (actual instanceof ShowMigrationCheckAlgorithmsStatement) {
- ExistingAssert.assertIs(assertContext, actual, expected);
} else if (actual instanceof ShowMigrationCheckStatusStatement) {
ShowMigrationCheckStatusStatementAssert.assertIs(assertContext, (ShowMigrationCheckStatusStatement) actual, (ShowMigrationCheckStatusStatementTestCase) expected);
} else if (actual instanceof ShowMigrationStatusStatement) {