fix busy log_cb not return when log sync success callback and TxCtx is exiting

This commit is contained in:
chinaxing
2024-04-23 17:35:34 +00:00
committed by ob-robot
parent 14961cf9f3
commit 8a11d33bfb
2 changed files with 15 additions and 18 deletions

View File

@ -427,11 +427,6 @@ void ObPartTransCtx::reset_log_cb_list_(common::ObDList<ObTxLogCb> &cb_list)
ObTxLogCb *cb = NULL; ObTxLogCb *cb = NULL;
while (OB_NOT_NULL(cb = cb_list.remove_first())) { while (OB_NOT_NULL(cb = cb_list.remove_first())) {
const bool is_dynamic = cb->is_dynamic(); const bool is_dynamic = cb->is_dynamic();
if (OB_NOT_NULL(cb->get_tx_data())) {
ObTxData *tx_data = cb->get_tx_data();
ctx_tx_data_.free_tmp_tx_data(tx_data);
cb->set_tx_data(nullptr);
}
if (!is_dynamic) { if (!is_dynamic) {
cb->reset(); cb->reset();
} else { } else {
@ -664,8 +659,8 @@ int ObPartTransCtx::handle_timeout(const int64_t delay)
} }
} }
// retry submit abort log // retry submit abort log for local tx abort
if (!is_follower_() if (!is_follower_() && is_local_tx_()
&& get_upstream_state() == ObTxState::ABORT && get_upstream_state() == ObTxState::ABORT
&& get_upstream_state() != get_downstream_state()) { && get_upstream_state() != get_downstream_state()) {
if (OB_FAIL(compensate_abort_log_())) { if (OB_FAIL(compensate_abort_log_())) {
@ -2222,11 +2217,12 @@ int ObPartTransCtx::on_success(ObTxLogCb *log_cb)
return_log_cb_(log_cb); return_log_cb_(log_cb);
} else if (is_exiting_) { } else if (is_exiting_) {
// the TxCtx maybe has been killed forcedly by background GC thread // the TxCtx maybe has been killed forcedly by background GC thread
// because the log_cb process skipped, here don't free log_cb directly // the log_cb process has been skipped
// the cleanup routine in destroy will handle, see `reset_log_cb_list_`
if (sub_state_.is_force_abort()) { if (sub_state_.is_force_abort()) {
TRANS_LOG(WARN, "ctx has been aborted forcedly before log sync successfully", KPC(this)); TRANS_LOG(WARN, "ctx has been aborted forcedly before log sync successfully", KPC(this));
print_trace_log_(); print_trace_log_();
busy_cbs_.remove(log_cb);
return_log_cb_(log_cb);
} else { } else {
TRANS_LOG_RET(ERROR, OB_ERR_UNEXPECTED, "callback was missed when tx ctx exiting", KPC(log_cb), KPC(this)); TRANS_LOG_RET(ERROR, OB_ERR_UNEXPECTED, "callback was missed when tx ctx exiting", KPC(log_cb), KPC(this));
print_trace_log_(); print_trace_log_();

View File

@ -364,7 +364,8 @@ int ObPartTransCtx::do_clear()
if (is_root()) { if (is_root()) {
// response scheduler after all participant commit log sycned // response scheduler after all participant commit log sycned
check_and_response_scheduler_(ObTxState::CLEAR, OB_SUCCESS); const int result = ctx_tx_data_.get_state() == ObTxCommitData::COMMIT ? OB_SUCCESS : OB_TRANS_ROLLBACKED;
check_and_response_scheduler_(ObTxState::CLEAR, result);
} }
// currently do nothing // currently do nothing