insert into tx_data if the ctx_tx_data is not read_only

This commit is contained in:
obdev 2022-12-19 10:07:59 +00:00 committed by ob-robot
parent 3daf5f634e
commit c7eda81427
2 changed files with 6 additions and 6 deletions

View File

@ -35,6 +35,8 @@ public:
void destroy();
int init(ObLSTxCtxMgr *ctx_mgr, int64_t tx_id);
bool is_read_only() const { return read_only_; }
int insert_into_tx_table();
int recover_tx_data(const storage::ObTxData *tmp_tx_data);
int replace_tx_data(storage::ObTxData *&tmp_tx_data);

View File

@ -4170,6 +4170,8 @@ int ObPartTransCtx::replay_commit(const ObTxCommitLog &commit_log,
true,
exec_info_.multi_data_source_))) {
TRANS_LOG(WARN, "notify data source failed", KR(ret), K(commit_log));
} else if ((!ctx_tx_data_.is_read_only()) && OB_FAIL(ctx_tx_data_.insert_into_tx_table())) {
TRANS_LOG(WARN, "insert to tx table failed", KR(ret), K(*this));
} else if (is_local_tx_()) {
if (OB_FAIL(trans_clear_())) {
TRANS_LOG(WARN, "transaction clear error or trans_type is sp_trans", KR(ret), "context", *this);
@ -4181,9 +4183,6 @@ int ObPartTransCtx::replay_commit(const ObTxCommitLog &commit_log,
}
if (OB_SUCC(ret)) {
sub_state_.set_state_log_submitted();
if (OB_FAIL(ctx_tx_data_.insert_into_tx_table())) {
TRANS_LOG(WARN, "insert to tx table failed", KR(ret), K(*this));
}
}
const int64_t used_time = timeguard.get_diff();
@ -4334,6 +4333,8 @@ int ObPartTransCtx::replay_abort(const ObTxAbortLog &abort_log,
TRANS_LOG(WARN, "transaction clear error", KR(ret), "context", *this);
} else if (OB_FAIL(notify_data_source_(NotifyType::ON_ABORT, timestamp, true, tmp_array))) {
TRANS_LOG(WARN, "notify data source failed", KR(ret), K(abort_log));
} else if ((!ctx_tx_data_.is_read_only()) && OB_FAIL(ctx_tx_data_.insert_into_tx_table())) {
TRANS_LOG(WARN, "insert to tx table failed", KR(ret), K(*this));
} else {
reset_redo_lsns_();
set_exiting_();
@ -4341,9 +4342,6 @@ int ObPartTransCtx::replay_abort(const ObTxAbortLog &abort_log,
}
if (OB_SUCC(ret)) {
sub_state_.set_state_log_submitted();
if (OB_FAIL(ctx_tx_data_.insert_into_tx_table())) {
TRANS_LOG(WARN, "insert to tx table failed", KR(ret), K(*this));
}
}
const int64_t used_time = timeguard.get_diff();
REC_TRANS_TRACE_EXT2(tlog_, replay_abort, OB_ID(ret), ret, OB_ID(used),