Skip to content

Commit 330bf9b

Browse files
committed
fix: check nil value
Signed-off-by: ekexium <[email protected]>
1 parent 0fdd255 commit 330bf9b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

txnkv/transaction/prewrite.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ func (c *twoPhaseCommitter) buildPrewriteRequest(batch batchMutations, txnSize u
9999
Value: m.GetValue(i),
100100
Assertion: assertion,
101101
}
102+
forceConstraintCheck := config.NextGen && (IsTempIndexKey == nil || !IsTempIndexKey(m.GetKey(i)))
102103
if m.IsPessimisticLock(i) {
103104
pessimisticActions[i] = kvrpcpb.PrewriteRequest_DO_PESSIMISTIC_CHECK
104-
} else if m.NeedConstraintCheckInPrewrite(i) ||
105-
(config.NextGen && IsTempIndexKey != nil && !IsTempIndexKey(m.GetKey(i))) {
105+
} else if m.NeedConstraintCheckInPrewrite(i) || forceConstraintCheck {
106106
// For next-gen builds, we need to perform constraint checks on all non-temporary index keys.
107107
// This is to prevent scenarios where a later lock's start_ts is smaller than the previous write's commit_ts,
108108
// which can be problematic for CDC and could potentially break correctness.

0 commit comments

Comments
 (0)