[BUG] only check sequence set with the first one

This commit is contained in:
Handora
2023-07-19 08:42:14 +00:00
committed by ob-robot
parent bcf3d94b1d
commit cd6e2d650c
3 changed files with 8 additions and 1 deletions

View File

@ -117,11 +117,14 @@ struct ObMvccWriteResult {
// tx_node_ is the node used for insert, whether it is inserted is decided by // tx_node_ is the node used for insert, whether it is inserted is decided by
// has_insert() // has_insert()
ObMvccTransNode *tx_node_; ObMvccTransNode *tx_node_;
// is_checked_ is used to tell lock_rows_on_forzen_stores whether sequence_set_violation has finished its check
bool is_checked_;
TO_STRING_KV(K_(can_insert), TO_STRING_KV(K_(can_insert),
K_(need_insert), K_(need_insert),
K_(is_new_locked), K_(is_new_locked),
K_(lock_state), K_(lock_state),
K_(is_checked),
KPC_(tx_node)); KPC_(tx_node));
ObMvccWriteResult() ObMvccWriteResult()
@ -129,7 +132,8 @@ struct ObMvccWriteResult {
need_insert_(false), need_insert_(false),
is_new_locked_(false), is_new_locked_(false),
lock_state_(), lock_state_(),
tx_node_(NULL) {} tx_node_(NULL),
is_checked_(false) {}
// has_insert indicates whether the insert is succeed // has_insert indicates whether the insert is succeed
// It is decided by both can_insert_ and need_insert_ // It is decided by both can_insert_ and need_insert_
@ -142,6 +146,7 @@ struct ObMvccWriteResult {
is_new_locked_ = false; is_new_locked_ = false;
lock_state_.reset(); lock_state_.reset();
tx_node_ = NULL; tx_node_ = NULL;
is_checked_ = false;
} }
}; };

View File

@ -914,6 +914,7 @@ int ObMvccRow::mvcc_write_(ObIMemtableCtx &ctx,
list_head_->get_dml_flag(), list_head_->get_dml_flag(),
list_head_->get_seq_no()))) { list_head_->get_seq_no()))) {
TRANS_LOG(WARN, "check sequence set violation failed", K(ret), KPC(this)); TRANS_LOG(WARN, "check sequence set violation failed", K(ret), KPC(this));
} else if (nullptr != list_head_ && FALSE_IT(res.is_checked_ = true)) {
} else if (OB_SUCC(check_double_insert_(snapshot_version, } else if (OB_SUCC(check_double_insert_(snapshot_version,
writer_node, writer_node,
list_head_))) { list_head_))) {

View File

@ -1205,6 +1205,7 @@ int ObMemtable::lock_row_on_frozen_stores_(
// We need check whether the same row is operated by same txn // We need check whether the same row is operated by same txn
// concurrently to prevent undesirable resuly. // concurrently to prevent undesirable resuly.
if (res.has_insert() && // we only need check when the node is exactly inserted if (res.has_insert() && // we only need check when the node is exactly inserted
!res.is_checked_ && // we only need check when the active memtable check is missed
OB_FAIL(concurrent_control::check_sequence_set_violation(ctx.mvcc_acc_ctx_.write_flag_, OB_FAIL(concurrent_control::check_sequence_set_violation(ctx.mvcc_acc_ctx_.write_flag_,
reader_seq_no, reader_seq_no,
my_tx_id, my_tx_id,