fix bug: register interrupt with guard not has a return code

This commit is contained in:
obdev
2023-11-06 11:43:57 +00:00
committed by ob-robot
parent e987af6eae
commit 607bfa740b
7 changed files with 293 additions and 173 deletions

View File

@ -25,12 +25,14 @@ OB_SERIALIZE_MEMBER(ObPxInterruptID, query_interrupt_id_, px_interrupt_id_);
ObPxInterruptGuard::ObPxInterruptGuard(const ObInterruptibleTaskID &interrupt_id)
{
interrupt_id_ = interrupt_id;
SET_INTERRUPTABLE(interrupt_id_);
interrupt_reg_ret_ = SET_INTERRUPTABLE(interrupt_id_);
}
ObPxInterruptGuard::~ObPxInterruptGuard()
{
UNSET_INTERRUPTABLE(interrupt_id_);
if (OB_SUCCESS == interrupt_reg_ret_) {
UNSET_INTERRUPTABLE(interrupt_id_);
}
}
int ObInterruptUtil::broadcast_px(ObIArray<ObDfo *> &dfos, int int_code)

View File

@ -55,8 +55,10 @@ class ObPxInterruptGuard
public:
ObPxInterruptGuard(const common::ObInterruptibleTaskID &interrupt_id_);
~ObPxInterruptGuard();
int get_interrupt_reg_ret() { return interrupt_reg_ret_; }
private:
common::ObInterruptibleTaskID interrupt_id_;
int interrupt_reg_ret_;
};

View File

@ -73,11 +73,15 @@ int ObInitSqcP::process()
*/
if (OB_NOT_NULL(sqc_handler)) {
ObPxRpcInitSqcArgs &arg = sqc_handler->get_sqc_init_arg();
SET_INTERRUPTABLE(arg.sqc_.get_interrupt_id().px_interrupt_id_);
unregister_interrupt_ = true;
if (OB_FAIL(SET_INTERRUPTABLE(arg.sqc_.get_interrupt_id().px_interrupt_id_))) {
LOG_WARN("sqc failed to SET_INTERRUPTABLE");
} else {
unregister_interrupt_ = true;
}
}
if (OB_ISNULL(sqc_handler)) {
if (OB_FAIL(ret)) {
} else if (OB_ISNULL(sqc_handler)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("Sqc handler can't be nullptr", K(ret));
} else if (OB_FAIL(sqc_handler->init_env())) {
@ -408,15 +412,19 @@ int ObInitFastSqcP::process()
ObPxRpcInitSqcArgs &arg = sqc_handler->get_sqc_init_arg();
arg.sqc_.set_task_count(1);
ObPxInterruptGuard px_int_guard(arg.sqc_.get_interrupt_id().px_interrupt_id_);
lib::CompatModeGuard g(session->get_compatibility_mode() == ORACLE_MODE ?
lib::Worker::CompatMode::ORACLE : lib::Worker::CompatMode::MYSQL);
sqc_handler->set_tenant_id(session->get_effective_tenant_id());
LOG_TRACE("process dfo",
K(arg),
K(session->get_compatibility_mode()),
K(sqc_handler->get_reserved_px_thread_count()));
if (OB_FAIL(startup_normal_sqc(*sqc_handler))) {
LOG_WARN("fail to startup normal sqc", K(ret));
if (OB_FAIL(px_int_guard.get_interrupt_reg_ret())) {
LOG_WARN("fast sqc failed to SET_INTERRUPTABLE");
} else {
lib::CompatModeGuard g(session->get_compatibility_mode() == ORACLE_MODE ?
lib::Worker::CompatMode::ORACLE : lib::Worker::CompatMode::MYSQL);
sqc_handler->set_tenant_id(session->get_effective_tenant_id());
LOG_TRACE("process dfo",
K(arg),
K(session->get_compatibility_mode()),
K(sqc_handler->get_reserved_px_thread_count()));
if (OB_FAIL(startup_normal_sqc(*sqc_handler))) {
LOG_WARN("fail to startup normal sqc", K(ret));
}
}
}

View File

@ -163,7 +163,9 @@ void PxWorkerFunctor::operator ()()
const bool enable_trace_log = lib::is_trace_log_enabled();
//ensure PX worker skip updating timeout_ts_ by ntp offset
THIS_WORKER.set_ntp_offset(0);
if (OB_NOT_NULL(sqc_handler) && OB_LIKELY(!sqc_handler->has_interrupted())) {
if (OB_FAIL(px_int_guard.get_interrupt_reg_ret())) {
LOG_WARN("px worker failed to SET_INTERRUPTABLE");
} else if (OB_NOT_NULL(sqc_handler) && OB_LIKELY(!sqc_handler->has_interrupted())) {
THIS_WORKER.set_worker_level(sqc_handler->get_rpc_level());
THIS_WORKER.set_curr_request_level(sqc_handler->get_rpc_level());
LOG_TRACE("init flt ctx", K(sqc_handler->get_flt_ctx()));