add some debug info and sanity check

This commit is contained in:
obdev
2024-02-09 13:20:54 +00:00
committed by ob-robot
parent 8ee4332655
commit c956e35328
2 changed files with 15 additions and 2 deletions

View File

@ -928,6 +928,13 @@ bool ObTxDesc::execute_commit_cb()
executed = true;
cb = commit_cb_;
commit_cb_ = NULL;
if (0 <= cb_tid_) {
#ifdef ENABLE_DEBUG_LOG
ob_abort();
#endif
TRANS_LOG(WARN, "unexpected error happen, cb_tid_ should smaller than 0",
KP(this), K(tx_id), KP(cb_tid_));
}
ATOMIC_STORE_REL(&cb_tid_, GETTID());
// NOTE: it is required add trace event before callback,
// because txDesc may be released after callback called
@ -937,7 +944,7 @@ bool ObTxDesc::execute_commit_cb()
OB_ID(thread_id), GETTID());
commit_cb_lock_.unlock();
cb->callback(commit_out_);
ATOMIC_STORE_REL(&cb_tid_, -1);
ATOMIC_STORE_REL(&cb_tid_, -GETTID());
} else {
commit_cb_lock_.unlock();
}

View File

@ -192,7 +192,7 @@ int ObTransService::reuse_tx(ObTxDesc &tx)
PAUSE();
if (++spin_cnt > 2000) {
TRANS_LOG(WARN, "blocking to wait tx referent quiescent cost too much time",
"tx_id", orig_tx_id, KP(&tx), K(final_ref_cnt), K(spin_cnt), K(tx.get_ref()));
"tx_id", orig_tx_id, KP(&tx), K(final_ref_cnt), K(spin_cnt), K(tx.get_ref()), K(cb_tid));
tx.print_trace();
usleep(2000000); // 2s
} else if (spin_cnt > 200) {
@ -200,6 +200,12 @@ int ObTransService::reuse_tx(ObTxDesc &tx)
} else if (spin_cnt > 100) {
usleep(200); // 200us
}
#ifdef ENABLE_DEBUG_LOG
if (spin_cnt > 2015) {
// at least wait 30s
ob_abort();
}
#endif
}
// it is safe to operate tx without lock when not shared
uint32_t session_id = tx.sess_id_;