Skip to content

Commit

Permalink
Use ShowMigrationCheckAlgorithmPluginsResultRowBuilder instead of Sho…
Browse files Browse the repository at this point in the history
…wMigrationCheckAlgorithmsExecutor (#30092)
  • Loading branch information
terrymanu authored Feb 11, 2024
1 parent 694943c commit 53e1b26
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# 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.
#

org.apache.shardingsphere.data.pipeline.migration.distsql.handler.query.ShowMigrationCheckAlgorithmPluginsResultRowBuilder
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@

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;
Expand Down Expand Up @@ -48,24 +64,8 @@
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;
Expand Down Expand Up @@ -142,7 +142,7 @@ public ASTNode visitCheckMigration(final CheckMigrationContext ctx) {

@Override
public ASTNode visitShowMigrationCheckAlgorithms(final ShowMigrationCheckAlgorithmsContext ctx) {
return new ShowMigrationCheckAlgorithmsStatement();
return new ShowPluginsStatement("MIGRATION_CHECK");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@
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;
Expand Down Expand Up @@ -55,8 +54,6 @@ public static void assertIs(final SQLCaseAssertContext assertContext, final Quer
// 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) {
Expand Down

0 comments on commit 53e1b26

Please sign in to comment.