Only the first layer of nested statements calls the start stmt hook
This commit is contained in:
@ -505,8 +505,13 @@ int ObSqlTransControl::start_stmt(ObExecContext &exec_ctx)
|
||||
OZ (get_tx_service(session, txs), tenant_id);
|
||||
OZ (acquire_tx_if_need_(txs, *session));
|
||||
OZ (stmt_sanity_check_(session, plan, plan_ctx));
|
||||
OZ (txs->sql_stmt_start_hook(session->get_xid(), *session->get_tx_desc(), session->get_sessid(), get_real_session_id(*session)));
|
||||
bool start_hook = OB_SUCC(ret) && !session->get_xid().empty() ? true : false;
|
||||
bool start_hook = false;
|
||||
if (exec_ctx.get_nested_level() == 0) {
|
||||
OZ (txs->sql_stmt_start_hook(session->get_xid(), *session->get_tx_desc(), session->get_sessid(), get_real_session_id(*session)));
|
||||
if (OB_SUCC(ret)) {
|
||||
start_hook = true;
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)
|
||||
&& txs->get_tx_elr_util().check_and_update_tx_elr_info(*session->get_tx_desc())) {
|
||||
LOG_WARN("check and update tx elr info", K(ret), KPC(session->get_tx_desc()));
|
||||
@ -877,7 +882,7 @@ int ObSqlTransControl::end_stmt(ObExecContext &exec_ctx, const bool rollback)
|
||||
}
|
||||
}
|
||||
// call end stmt hook
|
||||
if (OB_NOT_NULL(tx_desc) && OB_NOT_NULL(txs) && OB_NOT_NULL(session)) {
|
||||
if (OB_NOT_NULL(tx_desc) && OB_NOT_NULL(txs) && OB_NOT_NULL(session) && exec_ctx.get_nested_level() == 0) {
|
||||
int tmp_ret = txs->sql_stmt_end_hook(session->get_xid(), *tx_desc);
|
||||
if (OB_SUCCESS != tmp_ret) {
|
||||
LOG_WARN("call sql stmt end hook fail", K(tmp_ret));
|
||||
|
Reference in New Issue
Block a user