diff --git a/src/sql/ob_result_set.cpp b/src/sql/ob_result_set.cpp index cc2c01b9c..31047e1a2 100644 --- a/src/sql/ob_result_set.cpp +++ b/src/sql/ob_result_set.cpp @@ -894,8 +894,8 @@ int ObResultSet::close() } } // notify close fail to listener - int err = COVER_SUCC(do_close_plan_ret); - if (OB_SUCCESS != err && close_fail_cb_.is_valid()) { + int err = OB_SUCCESS != do_close_plan_ret ? do_close_plan_ret : ret; + if (OB_SUCCESS != err && err != errcode_ && close_fail_cb_.is_valid()) { close_fail_cb_(err); } //NG_TRACE_EXT(result_set_close, OB_ID(ret), ret, OB_ID(arg1), prev_ret, diff --git a/src/storage/memtable/ob_lock_wait_mgr.cpp b/src/storage/memtable/ob_lock_wait_mgr.cpp index f4c0084de..2557399b4 100644 --- a/src/storage/memtable/ob_lock_wait_mgr.cpp +++ b/src/storage/memtable/ob_lock_wait_mgr.cpp @@ -149,7 +149,7 @@ void RowHolderMapper::set_hash_holder(const ObTabletID &tablet_id, uint64_t hash = hash_rowkey(tablet_id, key); if (!tx_id.is_valid()) { TRANS_LOG(WARN, "trans_id is invalid", KR(ret), K(hash), K(tx_id)); - } else if (OB_FAIL(map_.insert(ObIntWarp(hash), tx_id))) { + } else if (OB_FAIL(map_.insert(ObIntWarp(hash), tx_id)) && OB_ENTRY_EXIST != ret) { TRANS_LOG(WARN, "set hash holder error", KR(ret), K(hash), K(tx_id)); } } diff --git a/src/storage/tx/ob_trans_define_v4.h b/src/storage/tx/ob_trans_define_v4.h index f7bb8e23c..045223599 100644 --- a/src/storage/tx/ob_trans_define_v4.h +++ b/src/storage/tx/ob_trans_define_v4.h @@ -117,20 +117,42 @@ public: } }; + +#define OB_TX_ABORT_CAUSE_LIST \ + _XX(TX_RESULT_INCOMPLETE) \ + _XX(IN_CONSIST_STATE) \ + _XX(SAVEPOINT_ROLLBACK_FAIL) \ + _XX(IMPLICIT_ROLLBACK) \ + _XX(SESSION_DISCONNECT) \ + _XX(STOP) \ + _XX(PARTICIPANT_STATE_INCOMPLETE) \ + _XX(PARTICIPANTS_SET_INCOMPLETE) \ + _XX(END_STMT_FAIL) \ + _XX(EXPLICIT_ROLLBACK) \ + enum ObTxAbortCause { - TX_RESULT_INCOMPLETE = 1, - IN_CONSIST_STATE = 2, - SAVEPOINT_ROLLBACK_FAIL = 3, - IMPLICIT_ROLLBACK = 4, - SESSION_DISCONNECT = 5, - STOP = 6, - PARTICIPANT_STATE_INCOMPLETE = 7, - PARTICIPANTS_SET_INCOMPLETE = 8, - END_STMT_FAIL = 9, - EXPLICIT_ROLLBACK = 10, +SUCCESS = 0, +#define _XX(X) X, +OB_TX_ABORT_CAUSE_LIST +#undef _XX }; +struct ObTxAbortCauseNames { + static char const* of(int i) { + static const char* names[] = { +#define _XX(X) #X, + OB_TX_ABORT_CAUSE_LIST +#undef _XX + }; + if (i < 0) { return common::ob_error_name(i); } + if (sizeof(names)/ sizeof(char*) <= i) { return "unknown"; } + return names[i]; + } +}; + +#undef OB_TX_ABORT_CAUSE_LIST + enum class ObTxClass { USER, SYS }; enum class ObTxConsistencyType diff --git a/src/storage/tx/ob_trans_part_ctx.cpp b/src/storage/tx/ob_trans_part_ctx.cpp index 1cc7320a3..88e375478 100755 --- a/src/storage/tx/ob_trans_part_ctx.cpp +++ b/src/storage/tx/ob_trans_part_ctx.cpp @@ -1801,7 +1801,10 @@ int ObPartTransCtx::abort_(int reason) if (OB_FAIL(do_local_tx_end_(TxEndAction::ABORT_TX))) { TRANS_LOG(WARN, "do local tx abort failed", K(ret), K(reason)); } - TRANS_LOG(INFO, "tx abort", K(ret), K(reason), KR(reason), KPC(this)); + // if abort was caused by internal impl reason, don't disturb + if (ObTxAbortCause::IMPLICIT_ROLLBACK != reason) { + TRANS_LOG(INFO, "tx abort", K(ret), K(reason), "reason_str", ObTxAbortCauseNames::of(reason), KPC(this)); + } return ret; } diff --git a/src/storage/tx/ob_trans_service_v4.cpp b/src/storage/tx/ob_trans_service_v4.cpp index f53f07932..9200290e6 100755 --- a/src/storage/tx/ob_trans_service_v4.cpp +++ b/src/storage/tx/ob_trans_service_v4.cpp @@ -587,7 +587,9 @@ int ObTransService::abort_tx_(ObTxDesc &tx, const int cause, const bool cleanup) } tx.state_ = ObTxDesc::State::ABORTED; } - TRANS_LOG(INFO, "abort tx", K(ret), K(*this), K(tx), K(cause)); + if (ObTxAbortCause::IMPLICIT_ROLLBACK != cause) { + TRANS_LOG(INFO, "abort tx", K(ret), K(*this), K(tx), K(cause)); + } return ret; } @@ -1913,7 +1915,9 @@ int ObTransService::handle_trans_abort_request(ObTxAbortMsg &abort_req, ObTransR if (OB_NOT_NULL(ctx)) { revert_tx_ctx_(ctx); } - TRANS_LOG(INFO, "handle trans abort request", K(ret), K(abort_req)); + if (ObTxAbortCause::IMPLICIT_ROLLBACK != abort_req.reason_) { + TRANS_LOG(INFO, "handle trans abort request", K(ret), K(abort_req)); + } return ret; } diff --git a/src/storage/tx/ob_tx_api.cpp b/src/storage/tx/ob_tx_api.cpp index bfca6836c..66be906a2 100644 --- a/src/storage/tx/ob_tx_api.cpp +++ b/src/storage/tx/ob_tx_api.cpp @@ -1768,7 +1768,9 @@ int ObTransService::start_epoch_(ObTxDesc &tx) } else if (OB_FAIL(tx.switch_to_idle())) { TRANS_LOG(WARN, "switch to idlefail", K(ret), K(tx)); } +#ifndef NDEBUG TRANS_LOG(INFO, "tx start new epoch", K(ret), K(tx)); +#endif } ObTransTraceLog &tlog = tx.get_tlog(); int tlog_truncate_cnt = 0;