PipelineExecutor: Avoid throwing in constructor after saving the querystatus

Otherwise the query status would keep a pointer to the executor which is dying at
that very moment
This commit is contained in:
Raúl Marín 2021-11-23 13:24:51 +01:00
parent 146c4a1157
commit cbe3a47f2f

View File

@ -32,8 +32,6 @@ PipelineExecutor::PipelineExecutor(Processors & processors, QueryStatus * elem)
try
{
graph = std::make_unique<ExecutingGraph>(processors);
if (process_list_element)
process_list_element->addPipelineExecutor(this);
}
catch (Exception & exception)
{
@ -51,8 +49,11 @@ PipelineExecutor::PipelineExecutor(Processors & processors, QueryStatus * elem)
auto settings = process_list_element->context.lock()->getSettings();
limits.max_execution_time = settings.max_execution_time;
overflow_mode = settings.timeout_overflow_mode;
// Add the pipeline to the QueryStatus at the end to avoid issues if other things throw
// as that would leave the executor "linked"
process_list_element->addPipelineExecutor(this);
}
checkTimeLimit();
}
PipelineExecutor::~PipelineExecutor()