提交 04204295 编写于 作者: C cr0 提交者: wangzelin.wzl

fix active_trx_count leak when add memtable fail

上级 b9542054
......@@ -260,17 +260,20 @@ int ObMemtableCtx::set_host_(ObMemtable* host, const bool for_replay)
ret = OB_NOT_MASTER;
} else if (host == get_active_mt()) {
// do nothing
} else if (memtable_arr_wrap_.is_contain_this_memtable(host)) {
ret = OB_ERR_UNEXPECTED;
TRANS_LOG(ERROR, "memstore already exist", K(ret), K(*this), KP(host));
} else if (memtable_arr_wrap_.is_reach_max_memtable_cnt()) {
ret = OB_ERR_UNEXPECTED;
TRANS_LOG(ERROR, "reach max memstore in storage", K(ret), K(*this), KP(host));
} else {
if (memtable_arr_wrap_.is_contain_this_memtable(host)) {
ret = OB_ERR_UNEXPECTED;
TRANS_LOG(ERROR, "memstore already exist", K(ret), K(*this), KP(host));
} else if (OB_FAIL(host->inc_active_trx_count())) {
TRANS_LOG(ERROR, "increase active_trx_count error", K(ret), K(*this), KP(host));
} else if (OB_FAIL(memtable_arr_wrap_.add_memtable(host))) {
int tmp_ret = OB_SUCCESS;
if (OB_SUCCESS != (tmp_ret = host->dec_active_trx_count())) {
TRANS_LOG(ERROR, "decrease active_trx_count error when add memtable fail", K(tmp_ret), K(ret), K(*this), KP(host));
} else {
memtable_arr_wrap_.add_memtable(host);
TRANS_LOG(WARN, "decrease active_trx_count success when add memtable fail", K(ret), K(*this), KP(host));
}
}
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册