[CP] fix show trace not show in standby database

This commit is contained in:
obdev
2024-02-10 05:31:32 +00:00
committed by ob-robot
parent 0e4919cb0f
commit 0b4699b3e9
2 changed files with 25 additions and 7 deletions

View File

@ -84,7 +84,6 @@ int ObVirtualShowTrace::retrive_all_span_info()
{
int ret = OB_SUCCESS;
ObMySQLTransaction trans;
bool with_snap_shot = true;
ObMySQLProxy *mysql_proxy = GCTX.sql_proxy_;
ObString trace_id;
if (OB_ISNULL(mysql_proxy)) {
@ -93,8 +92,6 @@ int ObVirtualShowTrace::retrive_all_span_info()
} else if (OB_ISNULL(session_)) {
ret = OB_NOT_INIT;
SERVER_LOG(WARN, "session is null", K(ret));
} else if (OB_FAIL(trans.start(mysql_proxy, effective_tenant_id_, with_snap_shot))) {
SERVER_LOG(WARN, "failed to start transaction", K(ret), K(effective_tenant_id_));
} else {
int sql_len = 0;
is_row_format_ = session_->is_row_traceformat();
@ -123,7 +120,7 @@ int ObVirtualShowTrace::retrive_all_span_info()
{ // make sure %res destructed before execute other sql in the same transaction
SMART_VAR(ObMySQLProxy::MySQLResult, res) {
common::sqlclient::ObMySQLResult *result = NULL;
ObISQLClient *sql_client = &trans;
ObISQLClient *sql_client = mysql_proxy;
uint64_t table_id = OB_ALL_VIRTUAL_TRACE_SPAN_INFO_TID;
ObSQLClientRetryWeak sql_client_retry_weak(sql_client,
exec_tenant_id,

View File

@ -243,6 +243,11 @@ void PxWorkerFunctor::operator ()(bool need_exec)
LOG_WARN("already interrupted");
}
if (OB_ISNULL(sqc_handler)) {
// do nothing
} else if (sqc_handler->get_flt_ctx().trace_id_.is_inited()) {
OBTRACE->reset();
}
PxWorkerFinishFunctor on_func_finish;
on_func_finish();
ObCurTraceId::reset();
@ -343,9 +348,25 @@ int ObPxThreadWorker::exit()
int ObPxLocalWorker::run(ObPxRpcInitTaskArgs &task_arg)
{
FLTSpanGuard(px_task);
ObPxTaskProcess task_proc(gctx_, task_arg);
return task_proc.process();
int ret = OB_SUCCESS;
ObPxSqcHandler *h = task_arg.get_sqc_handler();
if (OB_ISNULL(h)) {
} else if (h->get_flt_ctx().trace_id_.is_inited()) {
OBTRACE->init(h->get_flt_ctx());
}
{
FLTSpanGuard(px_task);
ObPxTaskProcess task_proc(gctx_, task_arg);
ret = task_proc.process();
}
if (OB_ISNULL(h)) {
} else if (h->get_flt_ctx().trace_id_.is_inited()) {
OBTRACE->reset();
}
return ret;
}
//////////////////////////////////////////////////////////////////////////////