[fix](vresultsink) BufferControlBlock may block all fragment handle threads (#16231)

BufferControlBlock may block all fragment handle threads leads to be out of work

modify include:

BufferControlBlock cancel after max timeout
StmtExcutor notify be to cancel the fragment when unexcepted occur
more details see issue #16203
This commit is contained in:
chenlinzhong
2023-01-30 16:53:21 +08:00
committed by GitHub
parent 342f3168b5
commit fdc042bb39
7 changed files with 26 additions and 5 deletions

View File

@ -994,6 +994,10 @@ public class Coordinator {
// fragment,
// if any, as well as all plan fragments on remote nodes.
public void cancel() {
cancel(Types.PPlanFragmentCancelReason.USER_CANCEL);
}
public void cancel(Types.PPlanFragmentCancelReason cancelReason) {
lock();
try {
if (!queryStatus.ok()) {
@ -1003,7 +1007,7 @@ public class Coordinator {
queryStatus.setStatus(Status.CANCELLED);
}
LOG.warn("cancel execution of query, this is outside invoke");
cancelInternal(Types.PPlanFragmentCancelReason.USER_CANCEL);
cancelInternal(cancelReason);
} finally {
unlock();
}

View File

@ -107,6 +107,7 @@ import org.apache.doris.planner.Planner;
import org.apache.doris.planner.ScanNode;
import org.apache.doris.proto.Data;
import org.apache.doris.proto.InternalService;
import org.apache.doris.proto.Types;
import org.apache.doris.qe.QueryState.MysqlStateType;
import org.apache.doris.qe.cache.Cache;
import org.apache.doris.qe.cache.CacheAnalyzer;
@ -1286,6 +1287,11 @@ public class StmtExecutor implements ProfileWriter {
context.getState().setEof();
plannerProfile.setQueryFetchResultFinishTime();
} catch (Exception e) {
// notify all be cancel runing fragment
// in some case may block all fragment handle threads
// details see issue https://github.com/apache/doris/issues/16203
LOG.warn("cancel fragment query_id:{} cause {}", DebugUtil.printId(context.queryId()), e.getMessage());
coord.cancel(Types.PPlanFragmentCancelReason.INTERNAL_ERROR);
fetchResultSpan.recordException(e);
throw e;
} finally {