Make failAbandonedQueries method more robust
When we fail the abandoned queries if for some reason an exception
is thrown for a query the rest of the queries will not be processed.
This change fixes that.
@@ -636,6 +636,7 @@ public class SqlQueryManager
public void failAbandonedQueries()
{
for (QueryExecution queryExecution : queries.values()) {
+ try {
QueryInfo queryInfo = queryExecution.getQueryInfo();
if (queryInfo.getState().isDone()) {
continue;
@@ -646,6 +647,10 @@ public class SqlQueryManager
queryExecution.fail(new PrestoException(ABANDONED_QUERY, format("Query %s has not been accessed since %s: currentTime %s", queryInfo.getQueryId(), queryInfo.getQueryStats().getLastHeartbeat(), DateTime.now())));
}
}
+ catch (RuntimeException e) {
+ log.error(e, "Exception failing abandoned query %s", queryExecution.getQueryId());
+ }
+ }
}
private boolean isAbandoned(QueryInfo queryInfo)
