MCPcopy Create free account
hub / github.com/ByConity/ByConity / cancelQuery

Method cancelQuery

src/Interpreters/ProcessList.cpp:552–590  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

550}
551
552CancellationCode QueryStatus::cancelQuery(bool kill, bool internal)
553{
554 UInt8 kill_flag = internal ? INTERNAL_KILL_BIT : EXTERNAL_KILL_BIT;
555 {
556 std::lock_guard lock(executors_mutex);
557 if (!executors.empty())
558 {
559 if (is_killed.load())
560 return CancellationCode::CancelSent;
561
562 is_killed.store(kill_flag);
563
564 for (auto * e : executors)
565 e->cancel();
566
567 return CancellationCode::CancelSent;
568 }
569 }
570
571 /// Streams are destroyed, and ProcessListElement will be deleted from ProcessList soon. We need wait a little bit
572 if (streamsAreReleased())
573 return CancellationCode::CancelSent;
574
575 BlockInputStreamPtr input_stream;
576 BlockOutputStreamPtr output_stream;
577
578 if (tryGetQueryStreams(input_stream, output_stream))
579 {
580 if (input_stream)
581 {
582 input_stream->cancel(kill);
583 return CancellationCode::CancelSent;
584 }
585 return CancellationCode::CancelCannotBeSent;
586 }
587 /// Query is not even started
588 is_killed.store(kill_flag);
589 return CancellationCode::CancelSent;
590}
591
592void QueryStatus::addPipelineExecutor(PipelineExecutor * e)
593{

Callers 4

sendCancelToQueryMethod · 0.45
killAllQueriesMethod · 0.45
killCurrentQueryMethod · 0.45

Calls 4

emptyMethod · 0.45
loadMethod · 0.45
storeMethod · 0.45
cancelMethod · 0.45

Tested by

no test coverage detected