fix tx_op release when deserialize tx_data from sstable alloc memory failed

This commit is contained in:
obdev 2024-05-21 06:47:41 +00:00 committed by ob-robot
parent 6cbe089d58
commit 471ffdb96c
3 changed files with 8 additions and 0 deletions

View File

@ -80,6 +80,8 @@ int ObSimpleClusterExampleTest::do_balance_inner_(uint64_t tenant_id)
ObBalanceJob job;
if (OB_FAIL(b_svr->gather_stat_())) {
LOG_WARN("failed to gather stat", KR(ret));
} else if (OB_FAIL(b_svr->gather_ls_status_stat(tenant_id, b_svr->ls_array_))) {
LOG_WARN("failed to gather stat", KR(ret));
} else if (OB_FAIL(ObBalanceJobTableOperator::get_balance_job(
tenant_id, false, *GCTX.sql_proxy_, job, start_time, finish_time))) {
if (OB_ENTRY_NOT_EXIST == ret) {

View File

@ -8315,6 +8315,8 @@ int ObPartTransCtx::recover_tx_ctx_from_tx_op_(ObTxOpVector &tx_op_list, const S
TRANS_LOG(WARN, "deserialize fail", KR(ret), KPC(this));
} else if (OB_FAIL(mt_ctx_.replay_lock(lock_op, tx_op.get_op_scn()))) {
TRANS_LOG(WARN, "recover lock_op failed", KR(ret), KPC(this));
} else {
TRANS_LOG(INFO, "recover lock_op from tx_op", KPC(this), K(lock_op), K(node_wrapper));
}
}
} else {

View File

@ -180,11 +180,15 @@ int ObTxOpVector::deserialize(const char *buf, const int64_t buf_len, int64_t &p
} else if (count_ > 0) {
if (OB_ISNULL(tx_op_ = (ObTxOp*)allocator.alloc(count_ * sizeof(ObTxOp)))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
STORAGE_LOG(WARN, "alloc mem fail", KR(ret), K(count_));
count_ = 0; // reset count_ make vector clear
} else {
capacity_ = count_;
}
for (int64_t idx = 0; OB_SUCC(ret) && idx < count_; idx++) {
new (&tx_op_[idx]) ObTxOp();
}
for (int64_t idx = 0; OB_SUCC(ret) && idx < count_; idx++) {
if (OB_FAIL(tx_op_[idx].deserialize(buf, buf_len, pos, allocator))) {
STORAGE_LOG(WARN, "deserialize fail", KR(ret));
}