[enhancement](util) print if using nereids planner when be coredump (#31981)

This commit is contained in:
TengJianPing
2024-03-08 23:42:11 +08:00
committed by yiguolei
parent d5bf20c96e
commit d2e7a68d11
7 changed files with 24 additions and 3 deletions

View File

@ -54,6 +54,7 @@ namespace doris::signal {
inline thread_local uint64 query_id_hi;
inline thread_local uint64 query_id_lo;
inline thread_local int64_t tablet_id = 0;
inline thread_local bool is_nereids = false;
namespace {
@ -244,6 +245,9 @@ void DumpTimeInfo() {
formatter.AppendString("-");
formatter.AppendUint64(query_id_lo, 16);
formatter.AppendString(" ***\n");
formatter.AppendString("*** is nereids: ");
formatter.AppendUint64(is_nereids, 10);
formatter.AppendString(" ***\n");
formatter.AppendString("*** tablet id: ");
formatter.AppendUint64(tablet_id, 10);
formatter.AppendString(" ***\n");
@ -436,6 +440,10 @@ inline void set_signal_task_id(TUniqueId tid) {
query_id_lo = tid.lo;
}
inline void set_signal_is_nereids(bool is_nereids_arg) {
is_nereids = is_nereids_arg;
}
inline void InstallFailureSignalHandler() {
// Build the sigaction struct.
struct sigaction sig_action;

View File

@ -612,7 +612,8 @@ Status FragmentMgr::_get_query_ctx(const Params& params, TUniqueId query_id, boo
// This may be a first fragment request of the query.
// Create the query fragments context.
query_ctx = QueryContext::create_shared(query_id, params.fragment_num_on_host, _exec_env,
params.query_options, params.coord, pipeline);
params.query_options, params.coord, pipeline,
params.is_nereids);
RETURN_IF_ERROR(DescriptorTbl::create(&(query_ctx->obj_pool), params.desc_tbl,
&(query_ctx->desc_tbl)));
// set file scan range params
@ -687,6 +688,7 @@ Status FragmentMgr::exec_plan_fragment(const TExecPlanFragmentParams& params,
std::shared_ptr<QueryContext> query_ctx;
bool pipeline_engine_enabled = params.query_options.__isset.enable_pipeline_engine &&
params.query_options.enable_pipeline_engine;
RETURN_IF_ERROR(
_get_query_ctx(params, params.params.query_id, pipeline_engine_enabled, query_ctx));
{

View File

@ -38,12 +38,13 @@ public:
QueryContext::QueryContext(TUniqueId query_id, int total_fragment_num, ExecEnv* exec_env,
const TQueryOptions& query_options, TNetworkAddress coord_addr,
bool is_pipeline)
bool is_pipeline, bool is_nereids)
: fragment_num(total_fragment_num),
timeout_second(-1),
_query_id(query_id),
_exec_env(exec_env),
_is_pipeline(is_pipeline),
_is_nereids(is_nereids),
_query_options(query_options) {
this->coord_addr = coord_addr;
_start_time = VecDateTimeValue::local_time();

View File

@ -70,7 +70,8 @@ class QueryContext {
public:
QueryContext(TUniqueId query_id, int total_fragment_num, ExecEnv* exec_env,
const TQueryOptions& query_options, TNetworkAddress coord_addr, bool is_pipeline);
const TQueryOptions& query_options, TNetworkAddress coord_addr, bool is_pipeline,
bool is_nereids);
~QueryContext();
@ -235,6 +236,8 @@ public:
_merge_controller_handler = handler;
}
bool is_nereids() const { return _is_nereids; }
DescriptorTbl* desc_tbl = nullptr;
bool set_rsc_info = false;
std::string user;
@ -269,6 +272,7 @@ private:
VecDateTimeValue _start_time;
int64_t _bytes_limit = 0;
bool _is_pipeline = false;
bool _is_nereids = false;
// A token used to submit olap scanner to the "_limited_scan_thread_pool",
// This thread pool token is created from "_limited_scan_thread_pool" from exec env.

View File

@ -533,4 +533,8 @@ Status RuntimeState::register_consumer_runtime_filter(const doris::TRuntimeFilte
consumer_filter, false, false);
}
}
bool RuntimeState::is_nereids() const {
return _query_ctx->is_nereids();
}
} // end namespace doris

View File

@ -579,6 +579,7 @@ public:
Status register_consumer_runtime_filter(const doris::TRuntimeFilterDesc& desc,
bool need_local_merge, int node_id,
doris::IRuntimeFilter** producer_filter);
bool is_nereids() const;
private:
Status create_error_log_file();

View File

@ -33,6 +33,7 @@ AttachTask::AttachTask(const std::shared_ptr<MemTrackerLimiter>& mem_tracker,
AttachTask::AttachTask(RuntimeState* runtime_state) {
ThreadLocalHandle::create_thread_local_if_not_exits();
signal::set_signal_task_id(runtime_state->query_id());
signal::set_signal_is_nereids(runtime_state->is_nereids());
thread_context()->attach_task(runtime_state->query_id(), runtime_state->fragment_instance_id(),
runtime_state->query_mem_tracker());
}