class TransportRenameTableAction extends TransportMasterNodeAction<RenameTableRequest, AcknowledgedResponse> {

    private static final String ACTION_NAME = "internal:crate:sql/table/rename";
    private static final IndicesOptions STRICT_INDICES_OPTIONS = IndicesOptions.fromOptions(false, false, false, false);

    private final RenameTableClusterStateExecutor executor;
    private final ActiveShardsObserver activeShardsObserver;

    @Inject
    public TransportRenameTableAction(TransportService transportService,
                                      ClusterService clusterService,
                                      ThreadPool threadPool,
                                      AllocationService allocationService,
                                      DDLClusterStateService ddlClusterStateService) {
        super(ACTION_NAME,
              transportService,
              clusterService,
              threadPool,
              RenameTableRequest::new
        );
        activeShardsObserver = new ActiveShardsObserver(clusterService);
        executor = new RenameTableClusterStateExecutor(
            allocationService,
            ddlClusterStateService
        );
    }

    @Override
    protected String executor() {
        return ThreadPool.Names.SAME;
    }

    @Override
    protected AcknowledgedResponse read(StreamInput in) throws IOException {
        return new AcknowledgedResponse(in);
    }

    @Override
    protected void masterOperation(RenameTableRequest request,
                                   ClusterState state,
                                   ActionListener<AcknowledgedResponse> listener) throws Exception {<FILL_FUNCTION_BODY>}

    @Override
    protected ClusterBlockException checkBlock(RenameTableRequest request, ClusterState state) {
        ViewsMetadata views = state.metadata().custom(ViewsMetadata.TYPE);
        if (views != null && views.contains(request.sourceName())) {
            return null;
        }
        try {
            return state.blocks().indicesBlockedException(
                ClusterBlockLevel.METADATA_WRITE,
                IndexNameExpressionResolver.concreteIndexNames(
                    state.metadata(),
                    STRICT_INDICES_OPTIONS,
                    request.sourceName().indexNameOrAlias()
                )
            );
        } catch (IndexNotFoundException e) {
            if (request.isPartitioned() == false) {
                throw e;
            }
            // empty partition, no indices just a template exists.
            return null;
        }
    }
}

        AtomicReference<String[]> newIndexNames = new AtomicReference<>(null);
        ActionListener<AcknowledgedResponse> waitForShardsListener = ActionListeners.waitForShards(
            listener,
            activeShardsObserver,
            request.timeout(),
            () -> logger.info("Renamed a relation, but the operation timed out waiting for enough shards to become available"),
            newIndexNames::get
        );

        clusterService.submitStateUpdateTask(
            "rename-table",
            new AckedClusterStateUpdateTask<AcknowledgedResponse>(Priority.HIGH, request, waitForShardsListener) {
                @Override
                public ClusterState execute(ClusterState currentState) throws Exception {
                    ClusterState updatedState = executor.execute(currentState, request);
                    IndicesOptions openIndices = IndicesOptions.fromOptions(
                        true,
                        true,
                        true,
                        false,
                        true,
                        true,
                        false
                    );
                    newIndexNames.set(IndexNameExpressionResolver.concreteIndexNames(
                        updatedState.metadata(), openIndices, request.targetName().indexNameOrAlias()));
                    return updatedState;
                }

                @Override
                protected AcknowledgedResponse newResponse(boolean acknowledged) {
                    return new AcknowledgedResponse(acknowledged);
                }
            });
    
<methods><variables>protected final non-sealed org.elasticsearch.cluster.service.ClusterService clusterService,private final non-sealed java.lang.String executor,protected final non-sealed org.elasticsearch.threadpool.ThreadPool threadPool,protected final non-sealed org.elasticsearch.transport.TransportService transportService