lulijun
lulijun

Reputation: 585

How does Presto kill a running query?

I'm learning Presto, and trying to figure out how does Presto kill a running query. But I'm confuse about the actual process.

I've known that when Presto get a kill request, or it decide to kill a query that cost too much memory, it will call SqlQueryExecution.fail, but this method seems like just change the QueryStateMachine, so how to stop the running thread?

@Override
public void fail(Throwable cause)
{
    requireNonNull(cause, "cause is null");

    stateMachine.transitionToFailed(cause);
}

I wonder at which step it aborts the running thread

Upvotes: 1

Views: 2319

Answers (1)

Piotr Findeisen
Piotr Findeisen

Reputation: 20770

Presto execution is managed in Driver instances. A Driver may be currently executing or waiting for a thread. If a Driver is waiting for a thread, it gets closed. In other case, it gets interrupted and closed.

Drivers live on workers. Worker gets information that it should finish from the coordinator. This happens for killed queries, but also for queries with LIMIT where only part of the data needs to be read.

Upvotes: 1

Related Questions