Skip to content

Commit

Permalink
Rename UpdatableRALExecutor (#29769)
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu authored Jan 18, 2024
1 parent 6b096d0 commit e6d4894
Show file tree
Hide file tree
Showing 38 changed files with 127 additions and 127 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;

/**
* Database aware RAL updater.
* Database aware updatable RAL executor.
*
* @param <T> type of SQL statement
*/
public interface DatabaseAwareRALUpdater<T extends UpdatableRALStatement> extends RALUpdater<T> {
public interface DatabaseAwareUpdatableRALExecutor<T extends UpdatableRALStatement> extends UpdatableRALExecutor<T> {

/**
* Set database.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
import java.sql.SQLException;

/**
* RAL updater.
* Updatable RAL executor.
*
* @param <T> type of updatable RAL statement
*/
@SingletonSPI
public interface RALUpdater<T extends UpdatableRALStatement> extends TypedSPI {
public interface UpdatableRALExecutor<T extends UpdatableRALStatement> extends TypedSPI {

/**
* Execute update.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
import org.apache.shardingsphere.data.pipeline.cdc.distsql.statement.DropStreamingStatement;
import org.apache.shardingsphere.data.pipeline.cdc.api.CDCJobAPI;
import org.apache.shardingsphere.data.pipeline.core.job.api.TransmissionJobAPI;
import org.apache.shardingsphere.distsql.handler.type.ral.update.RALUpdater;
import org.apache.shardingsphere.distsql.handler.type.ral.update.UpdatableRALExecutor;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;

import java.sql.SQLException;

/**
* Drop streaming updater.
* Drop streaming executor.
*/
public final class DropStreamingUpdater implements RALUpdater<DropStreamingStatement> {
public final class DropStreamingExecutor implements UpdatableRALExecutor<DropStreamingStatement> {

private final CDCJobAPI jobAPI = (CDCJobAPI) TypedSPILoader.getService(TransmissionJobAPI.class, "STREAMING");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.apache.shardingsphere.data.pipeline.scenario.consistencycheck.api.CreateConsistencyCheckJobParameter;
import org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobType;
import org.apache.shardingsphere.data.pipeline.scenario.migration.config.MigrationJobConfiguration;
import org.apache.shardingsphere.distsql.handler.type.ral.update.RALUpdater;
import org.apache.shardingsphere.distsql.handler.type.ral.update.UpdatableRALExecutor;
import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.CheckMigrationStatement;
Expand All @@ -36,9 +36,9 @@
import java.util.Properties;

/**
* Check migration job updater.
* Check migration job executor.
*/
public final class CheckMigrationJobUpdater implements RALUpdater<CheckMigrationStatement> {
public final class CheckMigrationJobExecutor implements UpdatableRALExecutor<CheckMigrationStatement> {

private final ConsistencyCheckJobAPI checkJobAPI = new ConsistencyCheckJobAPI(new ConsistencyCheckJobType());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
package org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update;

import org.apache.shardingsphere.data.pipeline.core.job.api.TransmissionJobAPI;
import org.apache.shardingsphere.distsql.handler.type.ral.update.RALUpdater;
import org.apache.shardingsphere.distsql.handler.type.ral.update.UpdatableRALExecutor;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.CommitMigrationStatement;

import java.sql.SQLException;

/**
* Commit migration updater.
* Commit migration executor.
*/
public final class CommitMigrationUpdater implements RALUpdater<CommitMigrationStatement> {
public final class CommitMigrationExecutor implements UpdatableRALExecutor<CommitMigrationStatement> {

@Override
public void executeUpdate(final CommitMigrationStatement sqlStatement) throws SQLException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

import org.apache.shardingsphere.data.pipeline.scenario.consistencycheck.ConsistencyCheckJobType;
import org.apache.shardingsphere.data.pipeline.scenario.consistencycheck.api.ConsistencyCheckJobAPI;
import org.apache.shardingsphere.distsql.handler.type.ral.update.RALUpdater;
import org.apache.shardingsphere.distsql.handler.type.ral.update.UpdatableRALExecutor;
import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.DropMigrationCheckStatement;

/**
* Drop migration check updater.
* Drop migration check executor.
*/
public final class DropMigrationCheckUpdater implements RALUpdater<DropMigrationCheckStatement> {
public final class DropMigrationCheckExecutor implements UpdatableRALExecutor<DropMigrationCheckStatement> {

private final ConsistencyCheckJobAPI jobAPI = new ConsistencyCheckJobAPI(new ConsistencyCheckJobType());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
import org.apache.shardingsphere.data.pipeline.core.job.api.TransmissionJobAPI;
import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.MigrateTableStatement;
import org.apache.shardingsphere.data.pipeline.scenario.migration.api.MigrationJobAPI;
import org.apache.shardingsphere.distsql.handler.type.ral.update.DatabaseAwareRALUpdater;
import org.apache.shardingsphere.distsql.handler.type.ral.update.DatabaseAwareUpdatableRALExecutor;
import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import org.apache.shardingsphere.infra.instance.metadata.InstanceType;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;

/**
* Migrate table updater.
* Migrate table executor.
*/
@Setter
public final class MigrateTableUpdater implements DatabaseAwareRALUpdater<MigrateTableStatement> {
public final class MigrateTableExecutor implements DatabaseAwareUpdatableRALExecutor<MigrateTableStatement> {

private ShardingSphereDatabase database;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.apache.shardingsphere.data.pipeline.core.context.PipelineContextKey;
import org.apache.shardingsphere.data.pipeline.core.job.api.TransmissionJobAPI;
import org.apache.shardingsphere.data.pipeline.scenario.migration.api.MigrationJobAPI;
import org.apache.shardingsphere.distsql.handler.type.ral.update.RALUpdater;
import org.apache.shardingsphere.distsql.handler.type.ral.update.UpdatableRALExecutor;
import org.apache.shardingsphere.distsql.handler.validate.DataSourcePoolPropertiesValidateHandler;
import org.apache.shardingsphere.distsql.segment.DataSourceSegment;
import org.apache.shardingsphere.distsql.segment.HostnameAndPortBasedDataSourceSegment;
Expand All @@ -40,9 +40,9 @@
import java.util.Map;

/**
* Register migration source storage unit updater.
* Register migration source storage unit executor.
*/
public final class RegisterMigrationSourceStorageUnitUpdater implements RALUpdater<RegisterMigrationSourceStorageUnitStatement> {
public final class RegisterMigrationSourceStorageUnitExecutor implements UpdatableRALExecutor<RegisterMigrationSourceStorageUnitStatement> {

private final MigrationJobAPI jobAPI = (MigrationJobAPI) TypedSPILoader.getService(TransmissionJobAPI.class, "MIGRATION");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
package org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update;

import org.apache.shardingsphere.data.pipeline.core.job.api.TransmissionJobAPI;
import org.apache.shardingsphere.distsql.handler.type.ral.update.RALUpdater;
import org.apache.shardingsphere.distsql.handler.type.ral.update.UpdatableRALExecutor;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.RollbackMigrationStatement;

import java.sql.SQLException;

/**
* Rollback migration updater.
* Rollback migration executor.
*/
public final class RollbackMigrationUpdater implements RALUpdater<RollbackMigrationStatement> {
public final class RollbackMigrationExecutor implements UpdatableRALExecutor<RollbackMigrationStatement> {

@Override
public void executeUpdate(final RollbackMigrationStatement sqlStatement) throws SQLException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

import org.apache.shardingsphere.data.pipeline.scenario.consistencycheck.ConsistencyCheckJobType;
import org.apache.shardingsphere.data.pipeline.scenario.consistencycheck.api.ConsistencyCheckJobAPI;
import org.apache.shardingsphere.distsql.handler.type.ral.update.RALUpdater;
import org.apache.shardingsphere.distsql.handler.type.ral.update.UpdatableRALExecutor;
import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.StartMigrationCheckStatement;

/**
* Start migration check updater.
* Start migration check executor.
*/
public final class StartMigrationCheckUpdater implements RALUpdater<StartMigrationCheckStatement> {
public final class StartMigrationCheckExecutor implements UpdatableRALExecutor<StartMigrationCheckStatement> {

private final ConsistencyCheckJobAPI jobAPI = new ConsistencyCheckJobAPI(new ConsistencyCheckJobType());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

import org.apache.shardingsphere.data.pipeline.core.job.service.PipelineJobManager;
import org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobType;
import org.apache.shardingsphere.distsql.handler.type.ral.update.RALUpdater;
import org.apache.shardingsphere.distsql.handler.type.ral.update.UpdatableRALExecutor;
import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.StartMigrationStatement;

/**
* Start migration updater.
* Start migration executor.
*/
public final class StartMigrationUpdater implements RALUpdater<StartMigrationStatement> {
public final class StartMigrationExecutor implements UpdatableRALExecutor<StartMigrationStatement> {

private final PipelineJobManager jobManager = new PipelineJobManager(new MigrationJobType());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

import org.apache.shardingsphere.data.pipeline.scenario.consistencycheck.ConsistencyCheckJobType;
import org.apache.shardingsphere.data.pipeline.scenario.consistencycheck.api.ConsistencyCheckJobAPI;
import org.apache.shardingsphere.distsql.handler.type.ral.update.RALUpdater;
import org.apache.shardingsphere.distsql.handler.type.ral.update.UpdatableRALExecutor;
import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.StopMigrationCheckStatement;

/**
* Stop migration check updater.
* Stop migration check executor.
*/
public final class StopMigrationCheckUpdater implements RALUpdater<StopMigrationCheckStatement> {
public final class StopMigrationCheckExecutor implements UpdatableRALExecutor<StopMigrationCheckStatement> {

private final ConsistencyCheckJobAPI jobAPI = new ConsistencyCheckJobAPI(new ConsistencyCheckJobType());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

import org.apache.shardingsphere.data.pipeline.core.job.service.PipelineJobManager;
import org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobType;
import org.apache.shardingsphere.distsql.handler.type.ral.update.RALUpdater;
import org.apache.shardingsphere.distsql.handler.type.ral.update.UpdatableRALExecutor;
import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.StopMigrationStatement;

/**
* Stop migration updater.
* Stop migration executor.
*/
public final class StopMigrationUpdater implements RALUpdater<StopMigrationStatement> {
public final class StopMigrationExecutor implements UpdatableRALExecutor<StopMigrationStatement> {

private final PipelineJobManager jobManager = new PipelineJobManager(new MigrationJobType());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
import org.apache.shardingsphere.data.pipeline.core.context.PipelineContextKey;
import org.apache.shardingsphere.data.pipeline.core.job.api.TransmissionJobAPI;
import org.apache.shardingsphere.data.pipeline.scenario.migration.api.MigrationJobAPI;
import org.apache.shardingsphere.distsql.handler.type.ral.update.RALUpdater;
import org.apache.shardingsphere.distsql.handler.type.ral.update.UpdatableRALExecutor;
import org.apache.shardingsphere.infra.instance.metadata.InstanceType;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.UnregisterMigrationSourceStorageUnitStatement;

/**
* Unregister migration source storage unit updater.
* Unregister migration source storage unit executor.
*/
public final class UnregisterMigrationSourceStorageUnitUpdater implements RALUpdater<UnregisterMigrationSourceStorageUnitStatement> {
public final class UnregisterMigrationSourceStorageUnitExecutor implements UpdatableRALExecutor<UnregisterMigrationSourceStorageUnitStatement> {

private final MigrationJobAPI jobAPI = (MigrationJobAPI) TypedSPILoader.getService(TransmissionJobAPI.class, "MIGRATION");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
# limitations under the License.
#

org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update.MigrateTableUpdater
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update.StartMigrationUpdater
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update.StopMigrationUpdater
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update.CommitMigrationUpdater
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update.RollbackMigrationUpdater
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update.RegisterMigrationSourceStorageUnitUpdater
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update.UnregisterMigrationSourceStorageUnitUpdater
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update.CheckMigrationJobUpdater
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update.StartMigrationCheckUpdater
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update.StopMigrationCheckUpdater
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update.DropMigrationCheckUpdater
org.apache.shardingsphere.data.pipeline.cdc.distsql.handler.update.DropStreamingUpdater
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update.MigrateTableExecutor
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update.StartMigrationExecutor
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update.StopMigrationExecutor
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update.CommitMigrationExecutor
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update.RollbackMigrationExecutor
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update.RegisterMigrationSourceStorageUnitExecutor
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update.UnregisterMigrationSourceStorageUnitExecutor
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update.CheckMigrationJobExecutor
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update.StartMigrationCheckExecutor
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update.StopMigrationCheckExecutor
org.apache.shardingsphere.data.pipeline.migration.distsql.handler.update.DropMigrationCheckExecutor
org.apache.shardingsphere.data.pipeline.cdc.distsql.handler.update.DropStreamingExecutor
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package org.apache.shardingsphere.proxy.backend.handler.distsql.ral;

import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.distsql.handler.type.ral.update.RALUpdater;
import org.apache.shardingsphere.distsql.handler.type.ral.update.DatabaseAwareRALUpdater;
import org.apache.shardingsphere.distsql.handler.type.ral.update.UpdatableRALExecutor;
import org.apache.shardingsphere.distsql.handler.type.ral.update.DatabaseAwareUpdatableRALExecutor;
import org.apache.shardingsphere.distsql.statement.ral.UpdatableRALStatement;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
Expand All @@ -45,9 +45,9 @@ public final class UpdatableRALBackendHandler<T extends UpdatableRALStatement> i
@SuppressWarnings("unchecked")
@Override
public ResponseHeader execute() throws SQLException {
RALUpdater<T> updater = TypedSPILoader.getService(RALUpdater.class, sqlStatement.getClass());
if (updater instanceof DatabaseAwareRALUpdater) {
((DatabaseAwareRALUpdater<T>) updater).setDatabase(ProxyContext.getInstance().getDatabase(DatabaseNameUtils.getDatabaseName(sqlStatement, connectionSession)));
UpdatableRALExecutor<T> updater = TypedSPILoader.getService(UpdatableRALExecutor.class, sqlStatement.getClass());
if (updater instanceof DatabaseAwareUpdatableRALExecutor) {
((DatabaseAwareUpdatableRALExecutor<T>) updater).setDatabase(ProxyContext.getInstance().getDatabase(DatabaseNameUtils.getDatabaseName(sqlStatement, connectionSession)));
}
updater.executeUpdate((T) sqlStatement);
return new UpdateResponseHeader(sqlStatement);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import com.google.common.base.Strings;
import lombok.Setter;
import org.apache.shardingsphere.distsql.handler.exception.storageunit.MissingRequiredStorageUnitsException;
import org.apache.shardingsphere.distsql.handler.type.ral.update.DatabaseAwareRALUpdater;
import org.apache.shardingsphere.distsql.handler.type.ral.update.DatabaseAwareUpdatableRALExecutor;
import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
Expand Down Expand Up @@ -51,10 +51,10 @@
import java.util.stream.Collectors;

/**
* Set readwrite-splitting storage unit status updater.
* Set readwrite-splitting storage unit status executor.
*/
@Setter
public final class AlterReadwriteSplittingStorageUnitStatusStatementUpdater implements DatabaseAwareRALUpdater<AlterReadwriteSplittingStorageUnitStatusStatement> {
public final class AlterReadwriteSplittingStorageUnitStatusStatementExecutor implements DatabaseAwareUpdatableRALExecutor<AlterReadwriteSplittingStorageUnitStatusStatement> {

private static final String DISABLE = "DISABLE";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
import org.apache.shardingsphere.data.pipeline.core.context.PipelineContextKey;
import org.apache.shardingsphere.data.pipeline.core.job.type.PipelineJobType;
import org.apache.shardingsphere.data.pipeline.core.metadata.PipelineProcessConfigurationPersistService;
import org.apache.shardingsphere.distsql.handler.type.ral.update.RALUpdater;
import org.apache.shardingsphere.distsql.handler.type.ral.update.UpdatableRALExecutor;
import org.apache.shardingsphere.distsql.statement.ral.updatable.AlterTransmissionRuleStatement;
import org.apache.shardingsphere.infra.instance.metadata.InstanceType;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.converter.TransmissionProcessConfigurationSegmentConverter;

/**
* Alter transmission rule updater.
* Alter transmission rule executor.
*/
public final class AlterTransmissionRuleUpdater implements RALUpdater<AlterTransmissionRuleStatement> {
public final class AlterTransmissionRuleExecutor implements UpdatableRALExecutor<AlterTransmissionRuleStatement> {

private final PipelineProcessConfigurationPersistService processConfigPersistService = new PipelineProcessConfigurationPersistService();

Expand Down
Loading

0 comments on commit e6d4894

Please sign in to comment.