[CP] [master] deadlock between memctx and partctx

This commit is contained in:
chinaxing
2023-08-01 17:24:27 +00:00
committed by ob-robot
parent a56c5b6dec
commit 0a387f044b
2 changed files with 20 additions and 30 deletions

View File

@ -769,8 +769,7 @@ int ObTransService::register_mds_into_tx(ObTxDesc &tx_desc,
time_guard.click("register in ctx begin");
do {
if (OB_FAIL(register_mds_into_ctx(*(arg.tx_desc_), ls_id, type, buf, buf_len,
register_flag))) {
if (OB_FAIL(register_mds_into_ctx_(*(arg.tx_desc_), ls_id, type, buf, buf_len, register_flag))) {
TRANS_LOG(WARN, "register msd into ctx failed", K(ret));
if (OB_EAGAIN == ret) {
if (ObTimeUtil::current_time() >= tx_desc.expire_ts_) {
@ -857,12 +856,12 @@ int ObTransService::register_mds_into_tx(ObTxDesc &tx_desc,
return ret;
}
int ObTransService::register_mds_into_ctx(ObTxDesc &tx_desc,
const ObLSID &ls_id,
const ObTxDataSourceType &type,
const char *buf,
const int64_t buf_len,
const ObRegisterMdsFlag &register_flag)
int ObTransService::register_mds_into_ctx_(ObTxDesc &tx_desc,
const ObLSID &ls_id,
const ObTxDataSourceType &type,
const char *buf,
const int64_t buf_len,
const ObRegisterMdsFlag &register_flag)
{
int ret = OB_SUCCESS;
ObStoreCtx store_ctx;
@ -877,22 +876,13 @@ int ObTransService::register_mds_into_ctx(ObTxDesc &tx_desc,
} else if (OB_FAIL(get_write_store_ctx(tx_desc, snapshot, write_flag, store_ctx, true))) {
TRANS_LOG(WARN, "get store ctx failed", KR(ret), K(tx_desc), K(ls_id));
} else {
do {
memtable::ObMvccWriteGuard guard;
if (OB_FAIL(guard.write_auth(store_ctx))) {
TRANS_LOG(WARN, "write auth failed", KR(ret), K(tx_desc), K(ls_id));
} else {
ObPartTransCtx *ctx = store_ctx.mvcc_acc_ctx_.tx_ctx_;
if (OB_ISNULL(ctx)) {
ret = OB_ERR_UNEXPECTED;
TRANS_LOG(WARN, "unexpected null ptr", KR(ret), K(tx_desc), K(ls_id), K(type));
} else if (OB_FAIL(ctx->register_multi_data_source(
type, buf, buf_len, false /* try lock */, register_flag))) {
TRANS_LOG(WARN, "register multi source data failed", KR(ret), K(tx_desc), K(ls_id),
K(type));
}
}
} while (0);
ObPartTransCtx *ctx = store_ctx.mvcc_acc_ctx_.tx_ctx_;
if (OB_ISNULL(ctx)) {
ret = OB_ERR_UNEXPECTED;
TRANS_LOG(WARN, "unexpected null ptr", KR(ret), K(tx_desc), K(ls_id), K(type));
} else if (OB_FAIL(ctx->register_multi_data_source(type, buf, buf_len, false /*try lock*/, register_flag))) {
TRANS_LOG(WARN, "register multi source data failed", KR(ret), K(tx_desc), K(ls_id), K(type), K(register_flag));
}
int tmp_ret = OB_SUCCESS;
if (OB_SUCCESS != (tmp_ret = revert_store_ctx(store_ctx))) {
TRANS_LOG(WARN, "revert store ctx failed", KR(tmp_ret), K(tx_desc), K(ls_id), K(type));

View File

@ -202,12 +202,6 @@ public:
const int64_t buf_len,
const int64_t request_id = 0,
const ObRegisterMdsFlag &register_flag = ObRegisterMdsFlag());
int register_mds_into_ctx(ObTxDesc &tx_desc,
const share::ObLSID &ls_id,
const ObTxDataSourceType &type,
const char *buf,
const int64_t buf_len,
const ObRegisterMdsFlag &register_flag);
ObTxELRUtil &get_tx_elr_util() { return elr_util_; }
#ifdef ENABLE_DEBUG_LOG
transaction::ObDefensiveCheckMgr *get_defensive_check_mgr() { return defensive_check_mgr_; }
@ -215,6 +209,12 @@ public:
private:
void check_env_();
bool can_create_ctx_(const int64_t trx_start_ts, const common::ObTsWindows &changing_leader_windows);
int register_mds_into_ctx_(ObTxDesc &tx_desc,
const share::ObLSID &ls_id,
const ObTxDataSourceType &type,
const char *buf,
const int64_t buf_len,
const ObRegisterMdsFlag &register_flag);
private:
int handle_redo_sync_task_(ObDupTableRedoSyncTask *task, bool &need_release_task);
int handle_dup_pre_commit_task_(ObPreCommitTask *task, bool &need_release_task);