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
ConstructorsConstructorDescriptionQueryStateProcessor(String queryIdString, QueryManager queryManager, DrillbitContext drillbitContext, Foreman.ForemanResult foremanResult) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToEventQueue(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.voidcancel()Transition query toCANCELLATION_REQUESTEDstate if it is not already in the terminal statesCANCELED},invalid @link
{@link QueryState#CANCELED,COMPLETED} orinvalid @link
{@link QueryState#COMPLETED,FAILED}.invalid @link
{@link QueryState#FAILED,voidclose()On close set proper increment / decrement counters depending on final query state.getState()voidmoveToState(UserBitShared.QueryResult.QueryState newState, Exception exception) Moves one query state to another, will fail when requested query state transition is not allowed.voidDirectly moves query from one state to another and updates ephemeral query store.voidStarts 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_REQUESTEDstate if it is not already in the terminal statesCANCELED},invalid @link
{@link QueryState#CANCELED,COMPLETED} orinvalid @link
{@link QueryState#COMPLETED,FAILED}. See the implementation ofinvalid @link
{@link QueryState#FAILED,moveToState(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:
closein interfaceAutoCloseable
-