Skip to content

Commit

Permalink
Merge #39055
Browse files Browse the repository at this point in the history
39055: storage: remain compatible with transactions missing their minimum timestamp r=tbg a=nvanbenschoten

Fixes #39008.

This was missed in #38782. I must have been thinking about the behavior
we'll want to switch to in v20.1. Luckily, the issue was easily caught
by `tpcc/mixed-headroom/n5cpu16`.

Release note: None

Co-authored-by: Nathan VanBenschoten <[email protected]>
  • Loading branch information
craig[bot] and nvanbenschoten committed Jul 23, 2019
2 parents 5cbc4b5 + ebbe064 commit 52941e2
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions pkg/storage/batcheval/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,19 @@ func CanPushWithPriority(pusher, pushee *roachpb.Transaction) bool {
func CanCreateTxnRecord(rec EvalContext, txn *roachpb.Transaction) error {
// Provide the transaction's minimum timestamp. The transaction could not
// have written a transaction record previously with a timestamp below this.
txnMinTS := txn.MinTimestamp
if txnMinTS.IsEmpty() {
return errors.Errorf("no minimum transaction timestamp provided: %v", txn)
//
// We use InclusiveTimeBounds to remain backward compatible. However, if we
// don't need to worry about compatibility, we require the transaction to
// have a minimum timestamp field.
// TODO(nvanbenschoten): Replace this with txn.MinTimestamp in v20.1.
txnMinTS, _ := txn.InclusiveTimeBounds()
if util.RaceEnabled {
newTxnMinTS := txn.MinTimestamp
if newTxnMinTS.IsEmpty() {
return errors.Errorf("no minimum transaction timestamp provided: %v", txn)
} else if newTxnMinTS != txnMinTS {
return errors.Errorf("minimum transaction timestamp differs from lower time bound: %v", txn)
}
}
ok, minCommitTS, reason := rec.CanCreateTxnRecord(txn.ID, txn.Key, txnMinTS)
if !ok {
Expand Down

0 comments on commit 52941e2

Please sign in to comment.