[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

@ -55,7 +55,7 @@ Status ResultBufferMgr::init() {
Status ResultBufferMgr::create_sender(const TUniqueId& query_id, int buffer_size,
std::shared_ptr<BufferControlBlock>* sender,
bool enable_pipeline) {
bool enable_pipeline, int query_timeout) {
*sender = find_control_block(query_id);
if (*sender != nullptr) {
LOG(WARNING) << "already have buffer control block for this instance " << query_id;
@ -73,6 +73,13 @@ Status ResultBufferMgr::create_sender(const TUniqueId& query_id, int buffer_size
{
std::lock_guard<std::mutex> l(_lock);
_buffer_map.insert(std::make_pair(query_id, control_block));
// BufferControlBlock should destroy after max_timeout
// for exceed max_timeout FE will return timeout to client
// otherwise in some case may block all fragment handle threads
// details see issue https://github.com/apache/doris/issues/16203
// add extra 5s for avoid corner case
int64_t max_timeout = time(nullptr) + query_timeout + 5;
cancel_at_time(max_timeout, query_id);
}
*sender = control_block;
return Status::OK();