Skip to content

Commit eceb178

Browse files
authored
Document plan execution across nodes (#125422)
1 parent 8ffecb4 commit eceb178

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/ComputeService.java

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,45 @@
6868
import static org.elasticsearch.xpack.esql.plugin.EsqlPlugin.ESQL_WORKER_THREAD_POOL_NAME;
6969

7070
/**
71-
* Computes the result of a {@link PhysicalPlan}.
71+
* Once query is parsed and validated it is scheduled for execution by {@code org.elasticsearch.xpack.esql.plugin.ComputeService#execute}
72+
* This method is responsible for splitting physical plan into coordinator and data node plans.
73+
*
74+
* Coordinator plan is immediately executed locally (using {@code org.elasticsearch.xpack.esql.plugin.ComputeService#runCompute})
75+
* and is prepared to collect and merge pages from data nodes into the final query result.
76+
*
77+
* Data node plan is passed to {@code org.elasticsearch.xpack.esql.plugin.DataNodeComputeHandler#startComputeOnDataNodes}
78+
* that is responsible for
79+
* <ul>
80+
* <li>
81+
* Determining list of nodes that contain shards referenced by the query with
82+
* {@code org.elasticsearch.xpack.esql.plugin.DataNodeRequestSender#searchShards}
83+
* </li>
84+
* <li>
85+
* Each node in the list processed in
86+
* {@code org.elasticsearch.xpack.esql.plugin.DataNodeComputeHandler#startComputeOnDataNodes}
87+
* in order to
88+
* <ul>
89+
* <li>
90+
* Open ExchangeSink on the target data node and link it with local ExchangeSource for the query
91+
* using `internal:data/read/esql/open_exchange` transport request.
92+
* {@see org.elasticsearch.compute.operator.exchange.ExchangeService#openExchange}
93+
* </li>
94+
* <li>
95+
* Start data node plan execution on the target data node
96+
* using `indices:data/read/esql/data` transport request
97+
* {@see org.elasticsearch.xpack.esql.plugin.DataNodeComputeHandler#messageReceived}
98+
* {@see org.elasticsearch.xpack.esql.plugin.DataNodeComputeHandler#runComputeOnDataNode}
99+
* </li>
100+
* <li>
101+
* While coordinator plan executor is running it will read data from ExchangeSource that will poll pages
102+
* from linked ExchangeSink on target data nodes or notify them that data set is already completed
103+
* (for example when running FROM * | LIMIT 10 type of query) or query is canceled
104+
* using `internal:data/read/esql/exchange` transport requests.
105+
* {@see org.elasticsearch.compute.operator.exchange.ExchangeService.ExchangeTransportAction#messageReceived}
106+
* </li>
107+
* </ul>
108+
* </li>
109+
* </ul>
72110
*/
73111
public class ComputeService {
74112
public static final String DATA_ACTION_NAME = EsqlQueryAction.NAME + "/data";

0 commit comments

Comments
 (0)