Search in sources :

Example 6 with PrestoTransportException

use of io.prestosql.spi.PrestoTransportException in project hetu-core by openlookeng.

the class RequestErrorTracker method requestFailed.

public void requestFailed(Throwable reason) throws PrestoException {
    // cancellation is not a failure
    if (reason instanceof CancellationException) {
        return;
    }
    if (reason instanceof RejectedExecutionException) {
        throw new PrestoException(REMOTE_TASK_ERROR, reason);
    }
    // log failure message
    if (isExpectedError(reason)) {
        // don't print a stack for a known errors
        log.warn("Error " + jobDescription + " %s: %s: %s", taskId, reason.getMessage(), taskUri);
    } else {
        log.warn(reason, "Error " + jobDescription + " %s: %s", taskId, taskUri);
    }
    // remember the first 10 errors
    if (errorsSinceLastSuccess.size() < 10) {
        errorsSinceLastSuccess.add(reason);
    }
    // fail the task, if we have more than X failures in a row and more than Y seconds have passed since the last request
    if (backoff.failure()) {
        // it is weird to mark the task failed locally and then cancel the remote task, but there is no way to tell a remote task that it is failed
        PrestoException exception = new PrestoTransportException(TOO_MANY_REQUESTS_FAILED, fromUri(taskUri), format("%s (%s %s - %s failures, failure duration %s, total failed request time %s)", WORKER_NODE_ERROR, jobDescription, taskUri, backoff.getFailureCount(), backoff.getFailureDuration().convertTo(SECONDS), backoff.getFailureRequestTimeTotal().convertTo(SECONDS)));
        errorsSinceLastSuccess.forEach(exception::addSuppressed);
        throw exception;
    }
}
Also used : CancellationException(java.util.concurrent.CancellationException) PrestoException(io.prestosql.spi.PrestoException) PrestoTransportException(io.prestosql.spi.PrestoTransportException) RejectedExecutionException(java.util.concurrent.RejectedExecutionException)

Aggregations

PrestoTransportException (io.prestosql.spi.PrestoTransportException)6 ImmutableList (com.google.common.collect.ImmutableList)2 PrestoException (io.prestosql.spi.PrestoException)2 Connector (io.prestosql.spi.connector.Connector)2 SQLException (java.sql.SQLException)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2 DataCenterColumnHandle (io.hetu.core.plugin.datacenter.DataCenterColumnHandle)1 TypeUtil.parseType (io.prestosql.client.util.TypeUtil.parseType)1 InformationSchemaConnector (io.prestosql.connector.informationschema.InformationSchemaConnector)1 SystemConnector (io.prestosql.connector.system.SystemConnector)1 ExecutionFailureInfo (io.prestosql.execution.ExecutionFailureInfo)1 Failure (io.prestosql.execution.Failure)1 ErrorCode (io.prestosql.spi.ErrorCode)1 HostAddress (io.prestosql.spi.HostAddress)1 StandardErrorCode (io.prestosql.spi.StandardErrorCode)1 ColumnStatistics (io.prestosql.spi.statistics.ColumnStatistics)1 DoubleRange (io.prestosql.spi.statistics.DoubleRange)1 TableStatistics (io.prestosql.spi.statistics.TableStatistics)1 Type (io.prestosql.spi.type.Type)1