BUGFIX: break deadlock at memctx and part ctx
This commit is contained in:
parent
58875bd2b7
commit
3648a21c43
@ -1280,7 +1280,8 @@ int ObMemtableCtx::register_multi_source_data_if_need_(
|
||||
// TODO: yanyuan.cxf need seqno to do rollback.
|
||||
} else if (OB_FAIL(part_ctx->register_multi_data_source(type,
|
||||
buf,
|
||||
serialize_size))) {
|
||||
serialize_size,
|
||||
true /* try lock */))) {
|
||||
TRANS_LOG(WARN, "register to multi source data failed", K(ret));
|
||||
} else {
|
||||
// do nothing
|
||||
|
@ -5680,7 +5680,8 @@ int ObPartTransCtx::notify_data_source_(const NotifyType notify_type,
|
||||
|
||||
int ObPartTransCtx::register_multi_data_source(const ObTxDataSourceType data_source_type,
|
||||
const char *buf,
|
||||
const int64_t len)
|
||||
const int64_t len,
|
||||
const bool try_lock)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
@ -5688,8 +5689,19 @@ int ObPartTransCtx::register_multi_data_source(const ObTxDataSourceType data_sou
|
||||
ObString data;
|
||||
void *ptr = nullptr;
|
||||
ObTxBufferNodeArray tmp_array;
|
||||
bool need_lock = true;
|
||||
|
||||
CtxLockGuard guard(lock_);
|
||||
if (try_lock) {
|
||||
// avoid deadlock, but give a timeout ts to avoid lock conflict short time.
|
||||
ret = lock_.lock(100000 /* 100ms */);
|
||||
// lock timeout need retry again outside.
|
||||
ret = OB_TIMEOUT == ret ? OB_EAGAIN : ret;
|
||||
need_lock = false;
|
||||
} else {
|
||||
// do nothing
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
CtxLockGuard guard(lock_, need_lock);
|
||||
|
||||
if (OB_UNLIKELY(nullptr == buf || len <= 0 || data_source_type <= ObTxDataSourceType::UNKNOWN
|
||||
|| data_source_type >= ObTxDataSourceType::MAX_TYPE)) {
|
||||
@ -5734,7 +5746,7 @@ int ObPartTransCtx::register_multi_data_source(const ObTxDataSourceType data_sou
|
||||
TRANS_LOG(WARN, "submit mds log failed", K(tmp_ret));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
TRANS_LOG(WARN,
|
||||
"register MDS redo in part_ctx failed",
|
||||
|
@ -378,7 +378,10 @@ public:
|
||||
role_state_ = for_replay ? TxCtxRoleState::FOLLOWER : TxCtxRoleState::LEADER;
|
||||
}
|
||||
|
||||
int register_multi_data_source(const ObTxDataSourceType type, const char *buf, const int64_t len);
|
||||
int register_multi_data_source(const ObTxDataSourceType type,
|
||||
const char *buf,
|
||||
const int64_t len,
|
||||
const bool try_lock = false);
|
||||
|
||||
const share::SCN get_start_log_ts()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user