Class QueryStateProcessor
java.lang.Object
org.apache.drill.exec.work.foreman.QueryStateProcessor
- All Implemented Interfaces:
AutoCloseable
Is responsible for query transition from one state to another,
incrementing / decrementing query statuses counters.
-
Constructor Summary
ConstructorDescriptionQueryStateProcessor
(String queryIdString, QueryManager queryManager, DrillbitContext drillbitContext, Foreman.ForemanResult foremanResult) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addToEventQueue
(UserBitShared.QueryResult.QueryState newState, Exception exception) Tells the foreman to move to a new state.
This will be added to the end of the event queue and will be processed once the foreman is ready to accept external events.void
cancel()
Transition query toCANCELLATION_REQUESTED
state if it is not already in the terminal states {@link QueryState#CANCELED, CANCELED}, {@link QueryState#COMPLETED, COMPLETED} or {@link QueryState#FAILED, FAILED}.void
close()
On close set proper increment / decrement counters depending on final query state.getState()
void
moveToState
(UserBitShared.QueryResult.QueryState newState, Exception exception) Moves one query state to another, will fail when requested query state transition is not allowed.void
Directly moves query from one state to another and updates ephemeral query store.void
Starts processing all events that were enqueued while all fragments were sending out.
-
Constructor Details
-
QueryStateProcessor
public QueryStateProcessor(String queryIdString, QueryManager queryManager, DrillbitContext drillbitContext, Foreman.ForemanResult foremanResult)
-
-
Method Details
-
getState
- Returns:
- current query state
-
cancel
public void cancel()Transition query toCANCELLATION_REQUESTED
state if it is not already in the terminal states {@link QueryState#CANCELED, CANCELED}, {@link QueryState#COMPLETED, COMPLETED} or {@link QueryState#FAILED, FAILED}. See the implementation ofmoveToState(QueryState, Exception)
for details. Note this can be called from outside of run() on another thread, or after run() completes -
startProcessingEvents
public void startProcessingEvents()Starts processing all events that were enqueued while all fragments were sending out. -
close
public void close()On close set proper increment / decrement counters depending on final query state.- Specified by:
close
in interfaceAutoCloseable
-