|
68 | 68 | import static org.elasticsearch.xpack.esql.plugin.EsqlPlugin.ESQL_WORKER_THREAD_POOL_NAME; |
69 | 69 |
|
70 | 70 | /** |
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> |
72 | 110 | */ |
73 | 111 | public class ComputeService { |
74 | 112 | public static final String DATA_ACTION_NAME = EsqlQueryAction.NAME + "/data"; |
|
0 commit comments