[fix](load) load core dump print load id (#22388)

save the load id to the thread context,
expect all task ids to be saved in thread context, compaction/schema change/etc.
This commit is contained in:
Xinyi Zou
2023-07-31 18:29:38 +08:00
committed by GitHub
parent 2a320ade82
commit 3b1be39033
3 changed files with 16 additions and 2 deletions

View File

@ -422,6 +422,16 @@ void FailureSignalHandler(int signal_number, siginfo_t* signal_info, void* ucont
} // namespace
inline void set_signal_task_id(PUniqueId tid) {
query_id_hi = tid.hi();
query_id_lo = tid.lo();
}
inline void set_signal_task_id(TUniqueId tid) {
query_id_hi = tid.hi;
query_id_lo = tid.lo;
}
inline void InstallFailureSignalHandler() {
// Build the sigaction struct.
struct sigaction sig_action;

View File

@ -33,13 +33,13 @@ ThreadContextPtr::ThreadContextPtr() {
AttachTask::AttachTask(const std::shared_ptr<MemTrackerLimiter>& mem_tracker,
const TUniqueId& task_id, const TUniqueId& fragment_instance_id) {
SwitchBthreadLocal::switch_to_bthread_local();
signal::set_signal_task_id(task_id);
thread_context()->attach_task(task_id, fragment_instance_id, mem_tracker);
}
AttachTask::AttachTask(RuntimeState* runtime_state) {
SwitchBthreadLocal::switch_to_bthread_local();
doris::signal::query_id_hi = runtime_state->query_id().hi;
doris::signal::query_id_lo = runtime_state->query_id().lo;
signal::set_signal_task_id(runtime_state->query_id());
thread_context()->attach_task(runtime_state->query_id(), runtime_state->fragment_instance_id(),
runtime_state->query_mem_tracker());
}

View File

@ -51,6 +51,7 @@
#include "common/config.h"
#include "common/exception.h"
#include "common/logging.h"
#include "common/signal_handler.h"
#include "common/status.h"
#include "gutil/integral_types.h"
#include "http/http_client.h"
@ -233,6 +234,7 @@ void PInternalServiceImpl::tablet_writer_open(google::protobuf::RpcController* c
bool ret = _light_work_pool.try_offer([this, request, response, done]() {
VLOG_RPC << "tablet writer open, id=" << request->id()
<< ", index_id=" << request->index_id() << ", txn_id=" << request->txn_id();
signal::set_signal_task_id(request->id());
brpc::ClosureGuard closure_guard(done);
auto st = _exec_env->load_channel_mgr()->open(*request);
if (!st.ok()) {
@ -373,6 +375,7 @@ void PInternalServiceImpl::_tablet_writer_add_block(google::protobuf::RpcControl
int64_t execution_time_ns = 0;
{
SCOPED_RAW_TIMER(&execution_time_ns);
signal::set_signal_task_id(request->id());
auto st = _exec_env->load_channel_mgr()->add_batch(*request, response);
if (!st.ok()) {
LOG(WARNING) << "tablet writer add block failed, message=" << st
@ -400,6 +403,7 @@ void PInternalServiceImpl::tablet_writer_cancel(google::protobuf::RpcController*
bool ret = _light_work_pool.try_offer([this, request, done]() {
VLOG_RPC << "tablet writer cancel, id=" << request->id()
<< ", index_id=" << request->index_id() << ", sender_id=" << request->sender_id();
signal::set_signal_task_id(request->id());
brpc::ClosureGuard closure_guard(done);
auto st = _exec_env->load_channel_mgr()->cancel(*request);
if (!st.ok()) {