Skip to content

Commit

Permalink
storage: add issue for sequence number errors on replaying DelRange
Browse files Browse the repository at this point in the history
Enhance the error message on sequence number errors when replaying a
transactional batch with a link to the possible cause, cockroachdb#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
  • Loading branch information
AlexTalks committed Dec 3, 2021
1 parent 7d374fc commit d34d1e5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/storage/mvcc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit d34d1e5

Please sign in to comment.