From cd6e2d650cf37ae1e1cb22a153eebcf4d1887660 Mon Sep 17 00:00:00 2001 From: Handora Date: Wed, 19 Jul 2023 08:42:14 +0000 Subject: [PATCH] [BUG] only check sequence set with the first one --- src/storage/memtable/mvcc/ob_mvcc_define.h | 7 ++++++- src/storage/memtable/mvcc/ob_mvcc_row.cpp | 1 + src/storage/memtable/ob_memtable.cpp | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/storage/memtable/mvcc/ob_mvcc_define.h b/src/storage/memtable/mvcc/ob_mvcc_define.h index fac97b49a5..a90e7101ee 100644 --- a/src/storage/memtable/mvcc/ob_mvcc_define.h +++ b/src/storage/memtable/mvcc/ob_mvcc_define.h @@ -117,11 +117,14 @@ struct ObMvccWriteResult { // tx_node_ is the node used for insert, whether it is inserted is decided by // has_insert() 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), K_(need_insert), K_(is_new_locked), K_(lock_state), + K_(is_checked), KPC_(tx_node)); ObMvccWriteResult() @@ -129,7 +132,8 @@ struct ObMvccWriteResult { need_insert_(false), is_new_locked_(false), lock_state_(), - tx_node_(NULL) {} + tx_node_(NULL), + is_checked_(false) {} // has_insert indicates whether the insert is succeed // It is decided by both can_insert_ and need_insert_ @@ -142,6 +146,7 @@ struct ObMvccWriteResult { is_new_locked_ = false; lock_state_.reset(); tx_node_ = NULL; + is_checked_ = false; } }; diff --git a/src/storage/memtable/mvcc/ob_mvcc_row.cpp b/src/storage/memtable/mvcc/ob_mvcc_row.cpp index 0c25af9010..e2337abfaf 100644 --- a/src/storage/memtable/mvcc/ob_mvcc_row.cpp +++ b/src/storage/memtable/mvcc/ob_mvcc_row.cpp @@ -914,6 +914,7 @@ int ObMvccRow::mvcc_write_(ObIMemtableCtx &ctx, list_head_->get_dml_flag(), list_head_->get_seq_no()))) { 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, writer_node, list_head_))) { diff --git a/src/storage/memtable/ob_memtable.cpp b/src/storage/memtable/ob_memtable.cpp index 5ea347bb61..83ab0583b5 100755 --- a/src/storage/memtable/ob_memtable.cpp +++ b/src/storage/memtable/ob_memtable.cpp @@ -1205,6 +1205,7 @@ int ObMemtable::lock_row_on_frozen_stores_( // We need check whether the same row is operated by same txn // concurrently to prevent undesirable resuly. 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_, reader_seq_no, my_tx_id,