提交 a11ae17d 编写于 作者: O obdev 提交者: ob-robot

rewrite ret code for bug/48008983

上级 8cd738a4
......@@ -59,12 +59,16 @@ int ObGVTxStat::prepare_start_to_read_()
} else if (OB_SUCCESS != (ret = fill_tenant_ids_())) {
SERVER_LOG(WARN, "fail to fill tenant ids", K(ret));
} else {
for (int i = 0; i < all_tenants_.count(); i++) {
for (int i = 0; i < all_tenants_.count() && OB_SUCC(ret); i++) {
int64_t cur_tenant_id = all_tenants_.at(i);
MTL_SWITCH(cur_tenant_id) {
transaction::ObTransService *txs = MTL(transaction::ObTransService*);
if (OB_SUCCESS != (ret = txs->iterate_all_observer_tx_stat(tx_stat_iter_))) {
SERVER_LOG(WARN, "iterate transaction stat error", K(ret), K(cur_tenant_id));
// when interate tenant failed, show all info collected, not need return error code
if (OB_NOT_RUNNING == ret || OB_NOT_INIT == ret) {
ret = OB_SUCCESS;
}
}
}
}
......
......@@ -1151,6 +1151,8 @@ int ObLSTxCtxMgr::iterate_tx_ctx_stat(ObTxStatIterator &tx_stat_iter)
} else {
IterateTxStatFunctor fn(tx_stat_iter);
if (OB_FAIL(ls_tx_ctx_map_.for_each(fn))) {
// rewrite eagain to real ret
ret = fn.get_ret();
TRANS_LOG(WARN, "for each transaction context error", KR(ret), "manager", *this);
}
}
......@@ -1878,6 +1880,8 @@ int ObTxCtxMgr::iterate_all_observer_tx_stat(ObTxStatIterator &tx_stat_iter)
} else {
IterateAllLSTxStatFunctor fn(tx_stat_iter);
if (OB_FAIL(foreach_ls_(fn))) {
// rewrite eagain to real ret code
ret = fn.get_ret();
TRANS_LOG(WARN, "foreach_ls_ tx_stat error", KR(ret));
} else {
// do nothing
......
......@@ -691,31 +691,37 @@ private:
class IterateAllLSTxStatFunctor
{
public:
explicit IterateAllLSTxStatFunctor(ObTxStatIterator &tx_stat_iter): tx_stat_iter_(tx_stat_iter) {}
explicit IterateAllLSTxStatFunctor(ObTxStatIterator &tx_stat_iter): tx_stat_iter_(tx_stat_iter),
ret_(OB_SUCCESS) {}
bool operator()(ObLSTxCtxMgr *ls_tx_ctx_mgr)
{
int tmp_ret = common::OB_SUCCESS;
int ret = common::OB_SUCCESS;
bool bool_ret = false;
if (OB_ISNULL(ls_tx_ctx_mgr)) {
tmp_ret = OB_INVALID_ARGUMENT;
TRANS_LOG_RET(WARN, tmp_ret, "invalid argument", KP(ls_tx_ctx_mgr));
ret = OB_INVALID_ARGUMENT;
TRANS_LOG_RET(WARN, ret, "invalid argument", KP(ls_tx_ctx_mgr));
} else {
const share::ObLSID &ls_id = ls_tx_ctx_mgr->get_ls_id();
if (!ls_id.is_valid()) {
tmp_ret = OB_INVALID_ARGUMENT;
TRANS_LOG_RET(WARN, tmp_ret, "invalid ls id", K(ls_id), KP(ls_tx_ctx_mgr));
} else if (OB_TMP_FAIL(ls_tx_ctx_mgr->iterate_tx_ctx_stat(tx_stat_iter_))) {
TRANS_LOG_RET(WARN, tmp_ret, "iterate_tx_ctx_stat error", K(tmp_ret), K(ls_id));
ret = OB_INVALID_ARGUMENT;
TRANS_LOG_RET(WARN, ret, "invalid ls id", K(ls_id), KP(ls_tx_ctx_mgr));
} else if (OB_FAIL(ls_tx_ctx_mgr->iterate_tx_ctx_stat(tx_stat_iter_))) {
TRANS_LOG_RET(WARN, ret, "iterate_tx_ctx_stat error", K(ret), K(ls_id));
} else {
bool_ret = true;
}
}
if (OB_FAIL(ret)) {
ret_ = ret;
}
return bool_ret;
}
int get_ret() const { return ret_; }
private:
ObTxStatIterator &tx_stat_iter_;
int ret_;
};
class IteratorTxIDFunctor
......@@ -749,15 +755,16 @@ private:
class IterateTxStatFunctor
{
public:
explicit IterateTxStatFunctor(ObTxStatIterator &tx_stat_iter) : tx_stat_iter_(tx_stat_iter) {}
explicit IterateTxStatFunctor(ObTxStatIterator &tx_stat_iter) : tx_stat_iter_(tx_stat_iter),
ret_(OB_SUCCESS){}
OPERATOR_V4(IterateTxStatFunctor)
{
int tmp_ret = common::OB_SUCCESS;
int ret = common::OB_SUCCESS;
bool bool_ret = false;
if (!tx_id.is_valid() || OB_ISNULL(tx_ctx)) {
tmp_ret = OB_INVALID_ARGUMENT;
TRANS_LOG_RET(WARN, tmp_ret, "invalid argument", K(tx_id), "ctx", OB_P(tx_ctx));
ret = OB_INVALID_ARGUMENT;
TRANS_LOG_RET(WARN, ret, "invalid argument", K(tx_id), "ctx", OB_P(tx_ctx));
// If you encounter a situation where tx_ctx has not been init yet,
// skip it directly, there will be a background thread retry
} else if (!tx_ctx->is_inited()) {
......@@ -773,11 +780,11 @@ public:
// If the transaction has not completed in 600 seconds, print its trace log
tx_ctx->print_trace_log();
}
if (OB_SUCCESS == tmp_ret) {
if (OB_SUCC(ret)) {
share::ObLSArray participants_arr;
if (OB_TMP_FAIL(tx_ctx->get_2pc_participants_copy(participants_arr))) {
TRANS_LOG_RET(WARN, tmp_ret, "ObTxStat get participants copy error", K(tmp_ret));
} else if (OB_TMP_FAIL(tx_stat.init(tx_ctx->addr_,
if (OB_FAIL(tx_ctx->get_2pc_participants_copy(participants_arr))) {
TRANS_LOG_RET(WARN, ret, "ObTxStat get participants copy error", K(ret));
} else if (OB_FAIL(tx_stat.init(tx_ctx->addr_,
tx_id,
tx_ctx->tenant_id_,
has_decided,
......@@ -801,22 +808,26 @@ public:
tx_ctx->exec_info_.xid_,
tx_ctx->exec_info_.upstream_,
tx_ctx->last_request_ts_))) {
TRANS_LOG_RET(WARN, tmp_ret, "ObTxStat init error", K(tmp_ret), KPC(tx_ctx));
} else if (OB_TMP_FAIL(tx_stat_iter_.push(tx_stat))) {
TRANS_LOG_RET(WARN, tmp_ret, "ObTxStatIterator push trans stat error", K(tmp_ret));
TRANS_LOG_RET(WARN, ret, "ObTxStat init error", K(ret), KPC(tx_ctx));
} else if (OB_FAIL(tx_stat_iter_.push(tx_stat))) {
TRANS_LOG_RET(WARN, ret, "ObTxStatIterator push trans stat error", K(ret));
} else {
// do nothing
}
}
}
if (OB_SUCCESS == tmp_ret) {
if (OB_SUCC(ret)) {
bool_ret = true;
} else {
ret_ = ret;
}
return bool_ret;
}
int get_ret() const { return ret_; }
private:
ObTxStatIterator &tx_stat_iter_;
int ret_;
};
class GetRecLogTSFunctor
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册