Search in sources :

Example 1 with AnalyzedDecommissionNode

use of io.crate.analyze.AnalyzedDecommissionNode in project crate by crate.

the class DecommissionNodePlan method executeOrFail.

@Override
public void executeOrFail(DependencyCarrier dependencies, PlannerContext plannerContext, RowConsumer consumer, Row params, SubQueryResults subQueryResults) {
    var boundedNodeIdOrName = boundNodeIdOrName(analyzedDecommissionNode, plannerContext.transactionContext(), plannerContext.nodeContext(), params, subQueryResults);
    String targetNodeId = NodeSelection.resolveNodeId(dependencies.clusterService().state().nodes(), boundedNodeIdOrName);
    dependencies.transportActionProvider().transportDecommissionNodeAction().execute(targetNodeId, new DecommissionNodeRequest(), new OneRowActionListener<>(consumer, r -> r.isAcknowledged() ? new Row1(1L) : new Row1(0L)));
}
Also used : RowConsumer(io.crate.data.RowConsumer) NodeContext(io.crate.metadata.NodeContext) SymbolEvaluator(io.crate.analyze.SymbolEvaluator) Row(io.crate.data.Row) DataTypes(io.crate.types.DataTypes) AnalyzedDecommissionNode(io.crate.analyze.AnalyzedDecommissionNode) SubQueryResults(io.crate.planner.operators.SubQueryResults) DecommissionNodeRequest(io.crate.cluster.decommission.DecommissionNodeRequest) VisibleForTesting(io.crate.common.annotations.VisibleForTesting) OneRowActionListener(io.crate.execution.support.OneRowActionListener) Row1(io.crate.data.Row1) CoordinatorTxnCtx(io.crate.metadata.CoordinatorTxnCtx) Row1(io.crate.data.Row1) DecommissionNodeRequest(io.crate.cluster.decommission.DecommissionNodeRequest)

Aggregations

AnalyzedDecommissionNode (io.crate.analyze.AnalyzedDecommissionNode)1 SymbolEvaluator (io.crate.analyze.SymbolEvaluator)1 DecommissionNodeRequest (io.crate.cluster.decommission.DecommissionNodeRequest)1 VisibleForTesting (io.crate.common.annotations.VisibleForTesting)1 Row (io.crate.data.Row)1 Row1 (io.crate.data.Row1)1 RowConsumer (io.crate.data.RowConsumer)1 OneRowActionListener (io.crate.execution.support.OneRowActionListener)1 CoordinatorTxnCtx (io.crate.metadata.CoordinatorTxnCtx)1 NodeContext (io.crate.metadata.NodeContext)1 SubQueryResults (io.crate.planner.operators.SubQueryResults)1 DataTypes (io.crate.types.DataTypes)1