From d34d1e58a211b670e637a57f568fad6e46a959a7 Mon Sep 17 00:00:00 2001 From: Alex Sarkesian Date: Fri, 3 Dec 2021 15:23:25 -0500 Subject: [PATCH] storage: add issue for sequence number errors on replaying `DelRange` Enhance the error message on sequence number errors when replaying a transactional batch with a link to the possible cause, #71236, stemming from an issue where a `DelRange` operation finds new keys to delete upon replay. This also changes the error from a generic error to an `AssertionFailed` error. Release note: None --- pkg/storage/mvcc.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/storage/mvcc.go b/pkg/storage/mvcc.go index af0668da1a47..c992b31af88f 100644 --- a/pkg/storage/mvcc.go +++ b/pkg/storage/mvcc.go @@ -1352,8 +1352,13 @@ func replayTransactionalWrite( writtenValue, found = meta.GetIntentValue(txn.Sequence) } if !found { - return errors.Errorf("transaction %s with sequence %d missing an intent with lower sequence %d", + // NB: This error may be due to a `DelRange` operation that, upon being replayed, finds a new key to delete + // which already has a write intent. See issue #71236. + err := errors.AssertionFailedf("transaction %s with sequence %d missing an intent with lower sequence %d", txn.ID, meta.Txn.Sequence, txn.Sequence) + errWithIssue := errors.WithIssueLink(err, + errors.IssueLink{IssueURL: "https://github.com/cockroachdb/cockroach/issues/71236"}) + return errWithIssue } // If the valueFn is specified, we must apply it to the would-be value at the key.