[master] misc refine for log print and others

This commit is contained in:
chinaxing 2023-07-04 04:12:23 +00:00 committed by ob-robot
parent 3a746dedb9
commit 26ed5c0da6
6 changed files with 47 additions and 16 deletions

View File

@ -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,

View File

@ -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));
}
}

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;