From 96b552a4381426869f9c03e6f66e140a7cf0e240 Mon Sep 17 00:00:00 2001 From: Nathan VanBenschoten Date: Thu, 27 Dec 2018 20:33:57 -0500 Subject: [PATCH 1/5] storage: remove VersionClientSideWritingFlag The setting is baked into 2.2 binaries. Release note: None --- pkg/internal/client/txn_test.go | 6 -- pkg/kv/txn_coord_sender_test.go | 64 ------------------- pkg/settings/cluster/cockroach_versions.go | 2 +- .../batcheval/cmd_begin_transaction.go | 5 -- pkg/storage/replica.go | 10 --- 5 files changed, 1 insertion(+), 86 deletions(-) diff --git a/pkg/internal/client/txn_test.go b/pkg/internal/client/txn_test.go index ffc8e991318a..bfcc5d10dff0 100644 --- a/pkg/internal/client/txn_test.go +++ b/pkg/internal/client/txn_test.go @@ -102,7 +102,6 @@ func newTestTxnFactory( if pErr != nil { return nil, pErr } - var writing bool status := roachpb.PENDING for i, req := range ba.Requests { args := req.GetInner() @@ -111,13 +110,9 @@ func newTestTxnFactory( union := &br.Responses[i] // avoid operating on copy union.MustSetInner(&testPutRespCopy) } - if roachpb.IsTransactionWrite(args) { - writing = true - } } if args, ok := ba.GetArg(roachpb.EndTransaction); ok { et := args.(*roachpb.EndTransactionRequest) - writing = true if et.Commit { status = roachpb.COMMITTED } else { @@ -128,7 +123,6 @@ func newTestTxnFactory( txnClone := ba.Txn.Clone() br.Txn = &txnClone if pErr == nil { - br.Txn.Writing = writing br.Txn.Status = status } // Update the MockTxnSender's proto. diff --git a/pkg/kv/txn_coord_sender_test.go b/pkg/kv/txn_coord_sender_test.go index b9862bbec9c4..9350099a9ff7 100644 --- a/pkg/kv/txn_coord_sender_test.go +++ b/pkg/kv/txn_coord_sender_test.go @@ -38,7 +38,6 @@ import ( "github.com/cockroachdb/cockroach/pkg/util/stop" "github.com/cockroachdb/cockroach/pkg/util/syncutil" "github.com/cockroachdb/cockroach/pkg/util/tracing" - "github.com/cockroachdb/cockroach/pkg/util/uuid" "github.com/pkg/errors" "github.com/stretchr/testify/require" "golang.org/x/sync/errgroup" @@ -890,67 +889,6 @@ func TestTxnMultipleCoord(t *testing.T) { } } -// TestTxnCoordSenderErrorWithIntent validates that if a transactional request -// returns an error but also indicates a Writing transaction, the coordinator -// tracks it just like a successful request. -// -// Note(andrei): This test was written at a time when the Writing status -// returned by the server mattered for the client. As of June 2018, that's no -// longer the case. The test doesn't hurt, though. -func TestTxnCoordSenderErrorWithIntent(t *testing.T) { - defer leaktest.AfterTest(t)() - stopper := stop.NewStopper() - defer stopper.Stop(context.TODO()) - manual := hlc.NewManualClock(123) - clock := hlc.NewClock(manual.UnixNano, 20*time.Nanosecond) - - testCases := []struct { - roachpb.Error - errMsg string - }{ - {*roachpb.NewError(roachpb.NewTransactionRetryError(roachpb.RETRY_REASON_UNKNOWN)), "retry txn"}, - { - *roachpb.NewError(roachpb.NewTransactionPushError(roachpb.Transaction{ - TxnMeta: enginepb.TxnMeta{ID: uuid.MakeV4()}}), - ), "failed to push", - }, - {*roachpb.NewErrorf("testError"), "testError"}, - } - for i, test := range testCases { - t.Run("", func(t *testing.T) { - var senderFn client.SenderFunc = func(_ context.Context, ba roachpb.BatchRequest) (*roachpb.BatchResponse, *roachpb.Error) { - txn := ba.Txn.Clone() - txn.Writing = true - pErr := &roachpb.Error{} - *pErr = test.Error - pErr.SetTxn(&txn) - return nil, pErr - } - factory := NewTxnCoordSenderFactory( - TxnCoordSenderFactoryConfig{ - AmbientCtx: log.AmbientContext{Tracer: tracing.NewTracer()}, - Clock: clock, - Stopper: stopper, - }, - senderFn, - ) - - var ba roachpb.BatchRequest - key := roachpb.Key("test") - ba.Add(&roachpb.PutRequest{RequestHeader: roachpb.RequestHeader{Key: key}}) - ba.Add(&roachpb.EndTransactionRequest{}) - txn := roachpb.MakeTransaction("test", key, 0, clock.Now(), 0) - meta := roachpb.MakeTxnCoordMeta(txn) - tc := factory.TransactionalSender(client.RootTxn, meta) - ba.Txn = &txn - _, pErr := tc.Send(context.Background(), ba) - if !testutils.IsPError(pErr, test.errMsg) { - t.Errorf("%d: error did not match %s: %v", i, test.errMsg, pErr) - } - }) - } -} - // TestTxnCoordSenderNoDuplicateIntents verifies that TxnCoordSender does not // generate duplicate intents and that it merges intents for overlapping ranges. func TestTxnCoordSenderNoDuplicateIntents(t *testing.T) { @@ -973,7 +911,6 @@ func TestTxnCoordSenderNoDuplicateIntents(t *testing.T) { br := ba.CreateReply() txnClone := ba.Txn.Clone() br.Txn = &txnClone - br.Txn.Writing = true return br, nil } ambient := log.AmbientContext{Tracer: tracing.NewTracer()} @@ -1333,7 +1270,6 @@ func TestAbortTransactionOnCommitErrors(t *testing.T) { if ba.Txn != nil && br.Txn == nil { txnClone := ba.Txn.Clone() br.Txn = &txnClone - br.Txn.Writing = true br.Txn.Status = roachpb.PENDING } } else if et, hasET := ba.GetArg(roachpb.EndTransaction); hasET { diff --git a/pkg/settings/cluster/cockroach_versions.go b/pkg/settings/cluster/cockroach_versions.go index b747be68524d..55ce4df99f35 100644 --- a/pkg/settings/cluster/cockroach_versions.go +++ b/pkg/settings/cluster/cockroach_versions.go @@ -60,7 +60,7 @@ const ( VersionRangeAppliedStateKey VersionImportFormats VersionSecondaryLookupJoins - VersionClientSideWritingFlag + VersionClientSideWritingFlag // unused VersionColumnarTimeSeries VersionTxnCoordMetaInvalidField VersionAsyncConsensus diff --git a/pkg/storage/batcheval/cmd_begin_transaction.go b/pkg/storage/batcheval/cmd_begin_transaction.go index ac6047253993..e86946ea9aa3 100644 --- a/pkg/storage/batcheval/cmd_begin_transaction.go +++ b/pkg/storage/batcheval/cmd_begin_transaction.go @@ -20,7 +20,6 @@ import ( "github.com/cockroachdb/cockroach/pkg/keys" "github.com/cockroachdb/cockroach/pkg/roachpb" - "github.com/cockroachdb/cockroach/pkg/settings/cluster" "github.com/cockroachdb/cockroach/pkg/storage/batcheval/result" "github.com/cockroachdb/cockroach/pkg/storage/engine" "github.com/cockroachdb/cockroach/pkg/storage/spanset" @@ -130,10 +129,6 @@ func BeginTransaction( // heartbeat arrives. reply.Txn.LastHeartbeat.Forward(cArgs.EvalCtx.Clock().Now()) - if !cArgs.EvalCtx.ClusterSettings().Version.IsActive(cluster.VersionClientSideWritingFlag) { - reply.Txn.Writing = true - } - // Write the txn record. txnRecord := reply.Txn.AsRecord() return result.Result{}, engine.MVCCPutProto(ctx, batch, cArgs.Stats, key, hlc.Timestamp{}, nil, &txnRecord) diff --git a/pkg/storage/replica.go b/pkg/storage/replica.go index 2131afef37f8..6b5fa31df4d0 100644 --- a/pkg/storage/replica.go +++ b/pkg/storage/replica.go @@ -3391,13 +3391,6 @@ func (r *Replica) evaluateProposal( if txn != nil && ba.Txn == nil { log.Fatalf(ctx, "error had a txn but batch is non-transactional. Err txn: %s", txn) } - if txn != nil && !r.ClusterSettings().Version.IsActive(cluster.VersionClientSideWritingFlag) { - // Restore the original txn's Writing bool if the error specifies a - // transaction. - if txn.ID == ba.Txn.ID { - txn.Writing = ba.Txn.Writing - } - } // Failed proposals can't have any Result except for what's // whitelisted here. @@ -5967,9 +5960,6 @@ func (r *Replica) evaluateWriteBatch( // timestamp. This can be different if the stripped batch was // executed at the server's hlc now timestamp. clonedTxn.Timestamp = br.Timestamp - if !r.ClusterSettings().Version.IsActive(cluster.VersionClientSideWritingFlag) { - clonedTxn.Writing = true - } // If the end transaction is not committed, clear the batch and mark the status aborted. if !etArg.Commit { From 5110516b6e7c3ad1aa43fe7fc4a6d49907381cc5 Mon Sep 17 00:00:00 2001 From: Nathan VanBenschoten Date: Fri, 28 Dec 2018 13:24:06 -0500 Subject: [PATCH 2/5] storage: move tscache-related methods to new file Updating and applying the timestamp cache are two sides of the same coin. It makes sense that these methods should live right next to each other. Release note: None --- pkg/storage/replica.go | 218 ----------------------------- pkg/storage/replica_tscache.go | 244 +++++++++++++++++++++++++++++++++ 2 files changed, 244 insertions(+), 218 deletions(-) create mode 100644 pkg/storage/replica_tscache.go diff --git a/pkg/storage/replica.go b/pkg/storage/replica.go index 6b5fa31df4d0..db63656739e4 100644 --- a/pkg/storage/replica.go +++ b/pkg/storage/replica.go @@ -2223,107 +2223,6 @@ func (ec *endCmds) done(br *roachpb.BatchResponse, pErr *roachpb.Error, retry pr } } -// updateTimestampCache updates the timestamp cache in order to set a low water -// mark for the timestamp at which mutations to keys overlapping the provided -// request can write, such that they don't re-write history. -func (r *Replica) updateTimestampCache( - ba *roachpb.BatchRequest, br *roachpb.BatchResponse, pErr *roachpb.Error, -) { - readOnlyUseReadCache := true - if r.store.Clock().MaxOffset() == timeutil.ClocklessMaxOffset { - // Clockless mode: all reads count as writes. - readOnlyUseReadCache = false - } - - tc := r.store.tsCache - // Update the timestamp cache using the timestamp at which the batch - // was executed. Note this may have moved forward from ba.Timestamp, - // as when the request is retried locally on WriteTooOldErrors. - ts := ba.Timestamp - if br != nil { - ts = br.Timestamp - } - var txnID uuid.UUID - if ba.Txn != nil { - txnID = ba.Txn.ID - } - for i, union := range ba.Requests { - args := union.GetInner() - if roachpb.UpdatesTimestampCache(args) { - // Skip update if there's an error and it's not for this index - // or the request doesn't update the timestamp cache on errors. - if pErr != nil { - if index := pErr.Index; !roachpb.UpdatesTimestampCacheOnError(args) || - index == nil || int32(i) != index.Index { - continue - } - } - header := args.Header() - start, end := header.Key, header.EndKey - switch t := args.(type) { - case *roachpb.EndTransactionRequest: - // EndTransaction adds the transaction key to the write - // timestamp cache to ensure replays create a transaction - // record with WriteTooOld set. - key := keys.TransactionKey(start, txnID) - tc.Add(key, nil, ts, txnID, false /* readCache */) - case *roachpb.ConditionalPutRequest: - if pErr != nil { - // ConditionalPut still updates on ConditionFailedErrors. - if _, ok := pErr.GetDetail().(*roachpb.ConditionFailedError); !ok { - continue - } - } - tc.Add(start, end, ts, txnID, readOnlyUseReadCache) - case *roachpb.ScanRequest: - resp := br.Responses[i].GetInner().(*roachpb.ScanResponse) - if resp.ResumeSpan != nil { - // Note that for forward scan, the resume span will start at - // the (last key read).Next(), which is actually the correct - // end key for the span to update the timestamp cache. - end = resp.ResumeSpan.Key - } - tc.Add(start, end, ts, txnID, readOnlyUseReadCache) - case *roachpb.ReverseScanRequest: - resp := br.Responses[i].GetInner().(*roachpb.ReverseScanResponse) - if resp.ResumeSpan != nil { - // Note that for reverse scans, the resume span's end key is - // an open interval. That means it was read as part of this op - // and won't be read on resume. It is the correct start key for - // the span to update the timestamp cache. - start = resp.ResumeSpan.EndKey - } - tc.Add(start, end, ts, txnID, readOnlyUseReadCache) - case *roachpb.QueryIntentRequest: - if t.IfMissing == roachpb.QueryIntentRequest_PREVENT { - resp := br.Responses[i].GetInner().(*roachpb.QueryIntentResponse) - if !resp.FoundIntent { - // If the QueryIntent request has an "if missing" behavior - // of PREVENT and the intent is missing then we update the - // timestamp cache at the intent's key to the intent's - // transactional timestamp. This will prevent the intent - // from ever being written in the future. We use an empty - // transaction ID so that we block the intent regardless - // of whether it is part of the current batch's transaction - // or not. - tc.Add(start, end, t.Txn.Timestamp, uuid.UUID{}, readOnlyUseReadCache) - } - } - case *roachpb.RefreshRequest: - tc.Add(start, end, ts, txnID, !t.Write /* readCache */) - case *roachpb.RefreshRangeRequest: - tc.Add(start, end, ts, txnID, !t.Write /* readCache */) - default: - readCache := readOnlyUseReadCache - if roachpb.UpdatesWriteTimestampCache(args) { - readCache = false - } - tc.Add(start, end, ts, txnID, readCache) - } - } - } -} - func (r *Replica) collectSpans(ba *roachpb.BatchRequest) (*spanset.SpanSet, error) { spans := &spanset.SpanSet{} // TODO(bdarnell): need to make this less global when local @@ -2488,123 +2387,6 @@ func (r *Replica) beginCmds( return ec, nil } -// applyTimestampCache moves the batch timestamp forward depending on -// the presence of overlapping entries in the timestamp cache. If the -// batch is transactional, the txn timestamp and the txn.WriteTooOld -// bool are updated. -// -// Two important invariants of Cockroach: 1) encountering a more -// recently written value means transaction restart. 2) values must -// be written with a greater timestamp than the most recent read to -// the same key. Check the timestamp cache for reads/writes which -// are at least as recent as the timestamp of this write. The cmd must -// update its timestamp to be greater than more recent values in the -// timestamp cache. When the write returns, the updated timestamp -// will inform the batch response timestamp or batch response txn -// timestamp. -// -// minReadTS is used as a per-request low water mark for the value returned from -// the read timestamp cache. That is, if the read timestamp cache returns a -// value below minReadTS, minReadTS (without an associated txn id) will be used -// instead to adjust the batch's timestamp. -// -// The timestamp cache also has a role in preventing replays of BeginTransaction -// reordered after an EndTransaction. If that's detected, an error will be -// returned. -func (r *Replica) applyTimestampCache( - ctx context.Context, ba *roachpb.BatchRequest, minReadTS hlc.Timestamp, -) (bool, *roachpb.Error) { - var bumped bool - for _, union := range ba.Requests { - args := union.GetInner() - if roachpb.ConsultsTimestampCache(args) { - header := args.Header() - // BeginTransaction is a special case. We use the transaction - // key to look for an entry which would indicate this transaction - // has already been finalized, in which case this BeginTxn might be a - // replay (it might also be delayed, coming in behind an async EndTxn). - // If the request hits the timestamp cache, then we return a retriable - // error: if this is a re-evaluation, then the error will be transformed - // into an ambiguous one higher up. Otherwise, if the client is still - // waiting for a result, then this cannot be a "replay" of any sort. - // - // The retriable error we return is a TransactionAbortedError, instructing - // the client to create a new transaction. Since a transaction record - // doesn't exist, there's no point in the client to continue with the - // existing transaction at a new epoch. - if _, ok := args.(*roachpb.BeginTransactionRequest); ok { - key := keys.TransactionKey(header.Key, ba.Txn.ID) - wTS, wTxnID := r.store.tsCache.GetMaxWrite(key, nil /* end */) - // GetMaxWrite will only find a timestamp interval with an - // associated txnID on the TransactionKey if an EndTxnReq has - // been processed. All other timestamp intervals will have no - // associated txnID and will be due to the low-water mark. - switch wTxnID { - case ba.Txn.ID: - newTxn := ba.Txn.Clone() - newTxn.Status = roachpb.ABORTED - newTxn.Timestamp.Forward(wTS.Next()) - return false, roachpb.NewErrorWithTxn(roachpb.NewTransactionAbortedError( - roachpb.ABORT_REASON_ALREADY_COMMITTED_OR_ROLLED_BACK_POSSIBLE_REPLAY), &newTxn) - case uuid.UUID{} /* noTxnID */ : - if !wTS.Less(ba.Txn.Timestamp) { - // On lease transfers the timestamp cache is reset with the transfer - // time as the low-water mark, so if this replica recently obtained - // the lease, this case will be true for new txns, even if they're - // not a replay. We move the timestamp forward and return retry. - newTxn := ba.Txn.Clone() - newTxn.Status = roachpb.ABORTED - newTxn.Timestamp.Forward(wTS.Next()) - return false, roachpb.NewErrorWithTxn(roachpb.NewTransactionAbortedError( - roachpb.ABORT_REASON_TIMESTAMP_CACHE_REJECTED_POSSIBLE_REPLAY), &newTxn) - } - default: - log.Fatalf(ctx, "unexpected tscache interval (%s,%s) on TxnKey %s", - wTS, wTxnID, key) - } - continue - } - - // Forward the timestamp if there's been a more recent read (by someone else). - rTS, rTxnID := r.store.tsCache.GetMaxRead(header.Key, header.EndKey) - if rTS.Forward(minReadTS) { - rTxnID = uuid.Nil - } - if ba.Txn != nil { - if ba.Txn.ID != rTxnID { - nextTS := rTS.Next() - if ba.Txn.Timestamp.Less(nextTS) { - txn := ba.Txn.Clone() - bumped = txn.Timestamp.Forward(nextTS) || bumped - ba.Txn = &txn - } - } - } else { - bumped = ba.Timestamp.Forward(rTS.Next()) || bumped - } - - // On more recent writes, forward the timestamp and set the - // write too old boolean for transactions. Note that currently - // only EndTransaction and DeleteRange requests update the - // write timestamp cache. - wTS, wTxnID := r.store.tsCache.GetMaxWrite(header.Key, header.EndKey) - if ba.Txn != nil { - if ba.Txn.ID != wTxnID { - if !wTS.Less(ba.Txn.Timestamp) { - txn := ba.Txn.Clone() - bumped = txn.Timestamp.Forward(wTS.Next()) || bumped - txn.WriteTooOld = true - ba.Txn = &txn - } - } - } else { - bumped = ba.Timestamp.Forward(wTS.Next()) || bumped - } - } - } - return bumped, nil -} - // executeAdminBatch executes the command directly. There is no interaction // with the spanlatch manager or the timestamp cache, as admin commands // are not meant to consistently access or modify the underlying data. diff --git a/pkg/storage/replica_tscache.go b/pkg/storage/replica_tscache.go new file mode 100644 index 000000000000..3d9aa6ed32c8 --- /dev/null +++ b/pkg/storage/replica_tscache.go @@ -0,0 +1,244 @@ +// Copyright 2018 The Cockroach Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. + +package storage + +import ( + "context" + + "github.com/cockroachdb/cockroach/pkg/keys" + "github.com/cockroachdb/cockroach/pkg/roachpb" + "github.com/cockroachdb/cockroach/pkg/util/hlc" + "github.com/cockroachdb/cockroach/pkg/util/log" + "github.com/cockroachdb/cockroach/pkg/util/timeutil" + "github.com/cockroachdb/cockroach/pkg/util/uuid" +) + +// updateTimestampCache updates the timestamp cache in order to set a low water +// mark for the timestamp at which mutations to keys overlapping the provided +// request can write, such that they don't re-write history. +func (r *Replica) updateTimestampCache( + ba *roachpb.BatchRequest, br *roachpb.BatchResponse, pErr *roachpb.Error, +) { + readOnlyUseReadCache := true + if r.store.Clock().MaxOffset() == timeutil.ClocklessMaxOffset { + // Clockless mode: all reads count as writes. + readOnlyUseReadCache = false + } + + tc := r.store.tsCache + // Update the timestamp cache using the timestamp at which the batch + // was executed. Note this may have moved forward from ba.Timestamp, + // as when the request is retried locally on WriteTooOldErrors. + ts := ba.Timestamp + if br != nil { + ts = br.Timestamp + } + var txnID uuid.UUID + if ba.Txn != nil { + txnID = ba.Txn.ID + } + for i, union := range ba.Requests { + args := union.GetInner() + if roachpb.UpdatesTimestampCache(args) { + // Skip update if there's an error and it's not for this index + // or the request doesn't update the timestamp cache on errors. + if pErr != nil { + if index := pErr.Index; !roachpb.UpdatesTimestampCacheOnError(args) || + index == nil || int32(i) != index.Index { + continue + } + } + header := args.Header() + start, end := header.Key, header.EndKey + switch t := args.(type) { + case *roachpb.EndTransactionRequest: + // EndTransaction adds the transaction key to the write + // timestamp cache to ensure replays create a transaction + // record with WriteTooOld set. + key := keys.TransactionKey(start, txnID) + tc.Add(key, nil, ts, txnID, false /* readCache */) + case *roachpb.ConditionalPutRequest: + if pErr != nil { + // ConditionalPut still updates on ConditionFailedErrors. + if _, ok := pErr.GetDetail().(*roachpb.ConditionFailedError); !ok { + continue + } + } + tc.Add(start, end, ts, txnID, readOnlyUseReadCache) + case *roachpb.ScanRequest: + resp := br.Responses[i].GetInner().(*roachpb.ScanResponse) + if resp.ResumeSpan != nil { + // Note that for forward scan, the resume span will start at + // the (last key read).Next(), which is actually the correct + // end key for the span to update the timestamp cache. + end = resp.ResumeSpan.Key + } + tc.Add(start, end, ts, txnID, readOnlyUseReadCache) + case *roachpb.ReverseScanRequest: + resp := br.Responses[i].GetInner().(*roachpb.ReverseScanResponse) + if resp.ResumeSpan != nil { + // Note that for reverse scans, the resume span's end key is + // an open interval. That means it was read as part of this op + // and won't be read on resume. It is the correct start key for + // the span to update the timestamp cache. + start = resp.ResumeSpan.EndKey + } + tc.Add(start, end, ts, txnID, readOnlyUseReadCache) + case *roachpb.QueryIntentRequest: + if t.IfMissing == roachpb.QueryIntentRequest_PREVENT { + resp := br.Responses[i].GetInner().(*roachpb.QueryIntentResponse) + if !resp.FoundIntent { + // If the QueryIntent request has an "if missing" behavior + // of PREVENT and the intent is missing then we update the + // timestamp cache at the intent's key to the intent's + // transactional timestamp. This will prevent the intent + // from ever being written in the future. We use an empty + // transaction ID so that we block the intent regardless + // of whether it is part of the current batch's transaction + // or not. + tc.Add(start, end, t.Txn.Timestamp, uuid.UUID{}, readOnlyUseReadCache) + } + } + case *roachpb.RefreshRequest: + tc.Add(start, end, ts, txnID, !t.Write /* readCache */) + case *roachpb.RefreshRangeRequest: + tc.Add(start, end, ts, txnID, !t.Write /* readCache */) + default: + readCache := readOnlyUseReadCache + if roachpb.UpdatesWriteTimestampCache(args) { + readCache = false + } + tc.Add(start, end, ts, txnID, readCache) + } + } + } +} + +// applyTimestampCache moves the batch timestamp forward depending on +// the presence of overlapping entries in the timestamp cache. If the +// batch is transactional, the txn timestamp and the txn.WriteTooOld +// bool are updated. +// +// Two important invariants of Cockroach: 1) encountering a more +// recently written value means transaction restart. 2) values must +// be written with a greater timestamp than the most recent read to +// the same key. Check the timestamp cache for reads/writes which +// are at least as recent as the timestamp of this write. The cmd must +// update its timestamp to be greater than more recent values in the +// timestamp cache. When the write returns, the updated timestamp +// will inform the batch response timestamp or batch response txn +// timestamp. +// +// minReadTS is used as a per-request low water mark for the value returned from +// the read timestamp cache. That is, if the read timestamp cache returns a +// value below minReadTS, minReadTS (without an associated txn id) will be used +// instead to adjust the batch's timestamp. +// +// The timestamp cache also has a role in preventing replays of BeginTransaction +// reordered after an EndTransaction. If that's detected, an error will be +// returned. +func (r *Replica) applyTimestampCache( + ctx context.Context, ba *roachpb.BatchRequest, minReadTS hlc.Timestamp, +) (bool, *roachpb.Error) { + var bumped bool + for _, union := range ba.Requests { + args := union.GetInner() + if roachpb.ConsultsTimestampCache(args) { + header := args.Header() + // BeginTransaction is a special case. We use the transaction + // key to look for an entry which would indicate this transaction + // has already been finalized, in which case this BeginTxn might be a + // replay (it might also be delayed, coming in behind an async EndTxn). + // If the request hits the timestamp cache, then we return a retriable + // error: if this is a re-evaluation, then the error will be transformed + // into an ambiguous one higher up. Otherwise, if the client is still + // waiting for a result, then this cannot be a "replay" of any sort. + // + // The retriable error we return is a TransactionAbortedError, instructing + // the client to create a new transaction. Since a transaction record + // doesn't exist, there's no point in the client to continue with the + // existing transaction at a new epoch. + if _, ok := args.(*roachpb.BeginTransactionRequest); ok { + key := keys.TransactionKey(header.Key, ba.Txn.ID) + wTS, wTxnID := r.store.tsCache.GetMaxWrite(key, nil /* end */) + // GetMaxWrite will only find a timestamp interval with an + // associated txnID on the TransactionKey if an EndTxnReq has + // been processed. All other timestamp intervals will have no + // associated txnID and will be due to the low-water mark. + switch wTxnID { + case ba.Txn.ID: + newTxn := ba.Txn.Clone() + newTxn.Status = roachpb.ABORTED + newTxn.Timestamp.Forward(wTS.Next()) + return false, roachpb.NewErrorWithTxn(roachpb.NewTransactionAbortedError( + roachpb.ABORT_REASON_ALREADY_COMMITTED_OR_ROLLED_BACK_POSSIBLE_REPLAY), &newTxn) + case uuid.UUID{} /* noTxnID */ : + if !wTS.Less(ba.Txn.Timestamp) { + // On lease transfers the timestamp cache is reset with the transfer + // time as the low-water mark, so if this replica recently obtained + // the lease, this case will be true for new txns, even if they're + // not a replay. We move the timestamp forward and return retry. + newTxn := ba.Txn.Clone() + newTxn.Status = roachpb.ABORTED + newTxn.Timestamp.Forward(wTS.Next()) + return false, roachpb.NewErrorWithTxn(roachpb.NewTransactionAbortedError( + roachpb.ABORT_REASON_TIMESTAMP_CACHE_REJECTED_POSSIBLE_REPLAY), &newTxn) + } + default: + log.Fatalf(ctx, "unexpected tscache interval (%s,%s) on TxnKey %s", + wTS, wTxnID, key) + } + continue + } + + // Forward the timestamp if there's been a more recent read (by someone else). + rTS, rTxnID := r.store.tsCache.GetMaxRead(header.Key, header.EndKey) + if rTS.Forward(minReadTS) { + rTxnID = uuid.Nil + } + if ba.Txn != nil { + if ba.Txn.ID != rTxnID { + nextTS := rTS.Next() + if ba.Txn.Timestamp.Less(nextTS) { + txn := ba.Txn.Clone() + bumped = txn.Timestamp.Forward(nextTS) || bumped + ba.Txn = &txn + } + } + } else { + bumped = ba.Timestamp.Forward(rTS.Next()) || bumped + } + + // On more recent writes, forward the timestamp and set the + // write too old boolean for transactions. Note that currently + // only EndTransaction and DeleteRange requests update the + // write timestamp cache. + wTS, wTxnID := r.store.tsCache.GetMaxWrite(header.Key, header.EndKey) + if ba.Txn != nil { + if ba.Txn.ID != wTxnID { + if !wTS.Less(ba.Txn.Timestamp) { + txn := ba.Txn.Clone() + bumped = txn.Timestamp.Forward(wTS.Next()) || bumped + txn.WriteTooOld = true + ba.Txn = &txn + } + } + } else { + bumped = ba.Timestamp.Forward(wTS.Next()) || bumped + } + } + } + return bumped, nil +} From ab4dffb88e303bd8f9715c39d5e8165b6cd1d023 Mon Sep 17 00:00:00 2001 From: Nathan VanBenschoten Date: Wed, 2 Jan 2019 18:25:39 -0500 Subject: [PATCH 3/5] storage: remove setTxnAutoGC(true) in tests The global defaults to true. Release note: None --- pkg/storage/replica_test.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/pkg/storage/replica_test.go b/pkg/storage/replica_test.go index e4947b6f13d7..d35b0a6d0c2d 100644 --- a/pkg/storage/replica_test.go +++ b/pkg/storage/replica_test.go @@ -3783,7 +3783,6 @@ func TestEndTransactionRollbackAbortedTransaction(t *testing.T) { // enjoy protection from "Raft retries". func TestRaftRetryProtectionInTxn(t *testing.T) { defer leaktest.AfterTest(t)() - defer setTxnAutoGC(true)() cfg := TestStoreConfig(nil) tc := testContext{} stopper := stop.NewStopper() @@ -3890,7 +3889,6 @@ func TestReplicaLaziness(t *testing.T) { // batch.WillNotBeRetried bit. func TestRaftRetryCantCommitIntents(t *testing.T) { defer leaktest.AfterTest(t)() - defer setTxnAutoGC(true)() tc := testContext{} stopper := stop.NewStopper() defer stopper.Stop(context.TODO()) @@ -4013,7 +4011,6 @@ func TestDuplicateBeginTransaction(t *testing.T) { // local relative to the transaction record's location. func TestEndTransactionLocalGC(t *testing.T) { defer leaktest.AfterTest(t)() - defer setTxnAutoGC(true)() tc := testContext{} tsc := TestStoreConfig(nil) tsc.TestingKnobs.EvalKnobs.TestingEvalFilter = From 7472973ffdc7edc49eedcb73f96c9de1630d385e Mon Sep 17 00:00:00 2001 From: Nathan VanBenschoten Date: Wed, 2 Jan 2019 18:48:08 -0500 Subject: [PATCH 4/5] roachpb: ignore error timestamp when restarting aborted txn The local hlc should have been advanced to at least the error's timestamp by the time PrepareTransactionForRetry is called. Release note: None --- pkg/kv/txn_coord_sender_test.go | 6 +++++- pkg/roachpb/data.go | 11 ++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pkg/kv/txn_coord_sender_test.go b/pkg/kv/txn_coord_sender_test.go index 9350099a9ff7..75e899976460 100644 --- a/pkg/kv/txn_coord_sender_test.go +++ b/pkg/kv/txn_coord_sender_test.go @@ -676,7 +676,7 @@ func TestTxnCoordSenderTxnUpdatedOnError(t *testing.T) { ctx := context.Background() origTS := makeTS(123, 0) plus10 := origTS.Add(10, 10) - plus20 := plus10.Add(10, 0) + plus20 := origTS.Add(20, 0) testCases := []struct { // The test's name. name string @@ -778,6 +778,10 @@ func TestTxnCoordSenderTxnUpdatedOnError(t *testing.T) { if pErr == nil { reply = ba.CreateReply() reply.Txn = ba.Txn + } else if txn := pErr.GetTxn(); txn != nil { + // Update the manual clock to simulate an + // error updating a local hlc clock. + manual.Set(txn.Timestamp.WallTime) } return reply, pErr } diff --git a/pkg/roachpb/data.go b/pkg/roachpb/data.go index 6a66225626f8..567559a9002e 100644 --- a/pkg/roachpb/data.go +++ b/pkg/roachpb/data.go @@ -1153,20 +1153,17 @@ func PrepareTransactionForRetry( // TODO(andrei): Should we preserve the ObservedTimestamps across the // restart? errTxnPri := txn.Priority - // The OrigTimestamp of the new transaction is going to be the greater of - // two the current clock and the timestamp received in the error. - // TODO(andrei): Can we just use the clock since it has already been - // advanced to at least the error's timestamp? + // Start the new transaction at the current time from the local clock. + // The local hlc should have been advanced to at least the error's + // timestamp already. now := clock.Now() - newTxnTimestamp := now - newTxnTimestamp.Forward(txn.Timestamp) txn = MakeTransaction( txn.Name, nil, // baseKey // We have errTxnPri, but this wants a UserPriority. So we're going to // overwrite the priority below. NormalUserPriority, - newTxnTimestamp, + now, clock.MaxOffset().Nanoseconds(), ) // Use the priority communicated back by the server. From 8143b45814590ef5d98d4ef65614e799938cb66c Mon Sep 17 00:00:00 2001 From: Nathan VanBenschoten Date: Fri, 28 Dec 2018 13:58:41 -0500 Subject: [PATCH 5/5] storage: allow HeartbeatTxn and EndTxn requests to create txn records Informs #25437. Informs #32971. This is the first part of addressing #32971. Part two will update concurrent txns to not immediately abort missing txn records and part three will update the txn client to stop sending BeginTxn records. The change closely resembles what was laid out in the corresponding RFC sections. `HeartbeatTxn` and `EndTxn` are both updated to permit the creation of transaction records when they finds that one is missing. To prevent replays from causing issues, they *both* check the write timestamp cache when creating a transaction record. This is one area where the change diverges from the RFC. Instead of having `EndTxn` always check the write timestamp cache, it only does so if it is creating a txn record from scratch. To make this safe, `HeartbeatTxn` also checks the write timestamp cache if it is creating a txn record from scratch. This prevents a long running transaction from increasingly running the risk of being aborted by a lease transfer as its `EndTxn` continues to be delayed. Instead, a lease transfer will only abort a transaction if it comes before the transaction record creation, which should be within a second of the transaction starting. The change pulls out a new `CanCreateTxnRecord` method, which has the potential of being useful for detecting eagerly GCed transaction records and solving the major problem from the RFC without an extra QueryIntent. This is what Andrei was pushing for before. More details are included in TODOs within the PR. _### Migration Safety Most of the changes to the transaction state machine are straightforward to validate. Transaction records can still never be created without checking for replays and only an EndTxn from the client's sync path can GC an ABORTED txn record. This means that it is still impossible for a transaction to move between the two finalized statuses (at some point it would be worth it to draw this state machine). The one tricky part is ensuring that the changes in this PR are safe when run in mixed-version clusters. The two areas of concern are: 1. lease transfers between a new and an old cluster on a range that should/does contain a transaction record. 2. an old txn client that is not expecting HeartbeatTxn and EndTxn requests to create txn records if they are found to be missing. 3. an old txn client may not expect a HeartbeatTxn to hit the write timestamp cache if run concurrently with an EndTxn. The first concern is protected by the write timestamp cache. Regardless of which replica creates that transaction record from a BeginTxn req or a HeartbeatTxn req (on the new replica), it will first need to check the timestamp cache. This prevents against any kind of replay that could create a transaction record that the old replica is not prepared to handle. We can break the second concern into two parts. First, an old txn client will never send an EndTxn without having sent a successful BeginTxn, so the new behavior there is not an issue. Second, an old txn client may send a HeartbeatTxn concurrently with a BeginTxn. If the heartbeat wins, it will create a txn record on a new replica. If the BeginTxn evaluates on a new replica, it will be a no-op. If it evaluates on an old replica, it will result in a retryable error. The third concern is specific to the implementation of the heartbeat loop itself. If a HeartbeatTxn loses a race with an EndTxn, it may get an aborted error after checking the timestamp cache. This is desirable from the replica-side, but we'd need to ensure that the client will handle it correctly. This PR adds some protection (see `sendingEndTxn`) to the txn client to prevent this case from causing weirdness on the client, but I don't think this could actually cause issues even without this protection. The reason is that the txn client might mark itself as aborted due to the heartbeat, but this will be overwritten when the EndTxn returns and the sql client will still hear back from the successful EndTxn. This must have actually always been an issue because it was always possible for a committed txn record to be GCed and then written as aborted later, at which point a concurrent heartbeat could have observed it. I'd like Andrei to sign off on this last hazard, as he's thought about this kind of thing more than anybody. Release note: None --- pkg/kv/dist_sender_server_test.go | 3 + pkg/kv/integration_test.go | 4 +- pkg/kv/txn_interceptor_heartbeat.go | 27 +- pkg/roachpb/api.go | 2 +- pkg/roachpb/data.go | 2 +- pkg/roachpb/errors.go | 9 - pkg/roachpb/errors.pb.go | 435 +++---- pkg/roachpb/errors.proto | 10 +- .../batcheval/cmd_begin_transaction.go | 31 +- pkg/storage/batcheval/cmd_end_transaction.go | 170 +-- pkg/storage/batcheval/cmd_heartbeat_txn.go | 18 +- .../batcheval/cmd_resolve_intent_test.go | 5 + pkg/storage/batcheval/eval_context.go | 11 + pkg/storage/replica_eval_context_span.go | 16 + pkg/storage/replica_test.go | 1125 ++++++++++++++--- pkg/storage/replica_tscache.go | 110 +- 16 files changed, 1425 insertions(+), 553 deletions(-) diff --git a/pkg/kv/dist_sender_server_test.go b/pkg/kv/dist_sender_server_test.go index fd90db1b551c..bebf9cfe5956 100644 --- a/pkg/kv/dist_sender_server_test.go +++ b/pkg/kv/dist_sender_server_test.go @@ -1609,6 +1609,9 @@ func TestReverseScanWithSplitAndMerge(t *testing.T) { func TestBadRequest(t *testing.T) { defer leaktest.AfterTest(t)() + t.Skip("TODO(andreimatei): This last assertion in this test was broken by #33150. " + + "I suspect the reason is that there is no longer a single Range " + + "that spans [KeyMin, z), so we're not hitting the error.") s, db := startNoSplitMergeServer(t) defer s.Stopper().Stop(context.TODO()) ctx := context.TODO() diff --git a/pkg/kv/integration_test.go b/pkg/kv/integration_test.go index c1750fe1eecb..6aa64d98133d 100644 --- a/pkg/kv/integration_test.go +++ b/pkg/kv/integration_test.go @@ -51,6 +51,7 @@ import ( // 3) Another txn runs into the intents on r2, tries to push, and succeeds // because the txn record doesn't exist yet. It writes the txn record as // Aborted. +// TODO(nvanbenschoten): This test will change when #25437 is fully addressed. // 4) If the Begin were to execute now, it'd discover the Aborted txn and return // a retryable TxnAbortedError. But it doesn't execute now; it's still delayed // somehow. @@ -67,6 +68,7 @@ import ( // result of this convoluted scenario. func TestDelayedBeginRetryable(t *testing.T) { defer leaktest.AfterTest(t)() + t.Skip(`Flaky, will be removed when #25437 is addressed`) // Here's how this test is gonna go: // - We're going to send a BeginTxn+Put(a)+Put(c). The first two will be split @@ -183,7 +185,7 @@ func TestDelayedBeginRetryable(t *testing.T) { if _, ok := pErr.GetDetail().(*roachpb.HandledRetryableTxnError); !ok { t.Fatalf("expected HandledRetryableTxnError, got: %v", pErr) } - exp := "TransactionAbortedError(ABORT_REASON_ALREADY_COMMITTED_OR_ROLLED_BACK_POSSIBLE_REPLAY)" + exp := "TransactionAbortedError(ABORT_REASON_ABORT_SPAN)" if !testutils.IsPError(pErr, regexp.QuoteMeta(exp)) { t.Fatalf("expected %s, got: %s", exp, pErr) } diff --git a/pkg/kv/txn_interceptor_heartbeat.go b/pkg/kv/txn_interceptor_heartbeat.go index 60e71b0bcb1c..1a3769277e12 100644 --- a/pkg/kv/txn_interceptor_heartbeat.go +++ b/pkg/kv/txn_interceptor_heartbeat.go @@ -459,20 +459,14 @@ func (h *txnHeartbeat) heartbeat(ctx context.Context) bool { // then we ignore the error. This is possible if the heartbeat loop was // started before a BeginTxn request succeeds because of ambiguity in the // first write request's response. + // + // TODO(nvanbenschoten): Remove this in 2.3. if tse, ok := pErr.GetDetail().(*roachpb.TransactionStatusError); ok && tse.Reason == roachpb.TransactionStatusError_REASON_TXN_NOT_FOUND { return true } - if pErr.GetTxn() != nil { - // It is not expected for a 2.1 node to return an error with a transaction - // in it. For one, heartbeats are not supposed to return - // TransactionAbortedErrors. - // TODO(andrei): Remove this in 2.2. - respTxn = pErr.GetTxn() - } else { - return true - } + respTxn = pErr.GetTxn() } else { respTxn = br.Responses[0].GetInner().(*roachpb.HeartbeatTxnResponse).Txn } @@ -480,6 +474,15 @@ func (h *txnHeartbeat) heartbeat(ctx context.Context) bool { // Update our txn. In particular, we need to make sure that the client will // notice when the txn has been aborted (in which case we'll give them an // error on their next request). + // + // TODO(nvanbenschoten): It's possible for a HeartbeatTxn request to observe + // the result of an EndTransaction request and beat it back to the client. + // This is an issue when a COMMITTED txn record is GCed and later re-written + // as ABORTED. The coordinator's local status could flip from PENDING to + // ABORTED (after heartbeat response) to COMMITTED (after commit response). + // This appears to be benign, but it's still somewhat disconcerting. If this + // ever causes any issues, we'll need to be smarter about detecting this race + // on the client and conditionally ignoring the result of heartbeat responses. h.mu.txn.Update(respTxn) if h.mu.txn.Status != roachpb.PENDING { if h.mu.txn.Status == roachpb.ABORTED { @@ -494,12 +497,6 @@ func (h *txnHeartbeat) heartbeat(ctx context.Context) bool { // abortTxnAsyncLocked send an EndTransaction(commmit=false) asynchronously. // The asyncAbortCallbackLocked callback is also called. func (h *txnHeartbeat) abortTxnAsyncLocked(ctx context.Context) { - // Stop the heartbeat loop if it is still running. - if h.mu.txnEnd != nil { - close(h.mu.txnEnd) - h.mu.txnEnd = nil - } - if h.mu.txn.Status != roachpb.ABORTED { log.Fatalf(ctx, "abortTxnAsyncLocked called for non-aborted txn: %s", h.mu.txn) } diff --git a/pkg/roachpb/api.go b/pkg/roachpb/api.go index ac5da277c9ae..f50ffbb3befc 100644 --- a/pkg/roachpb/api.go +++ b/pkg/roachpb/api.go @@ -1015,7 +1015,7 @@ func (*ScanRequest) flags() int { return isRead | isRange | isTxn | update func (*ReverseScanRequest) flags() int { return isRead | isRange | isReverse | isTxn | updatesReadTSCache | needsRefresh } -func (*BeginTransactionRequest) flags() int { return isWrite | isTxn | consultsTSCache } +func (*BeginTransactionRequest) flags() int { return isWrite | isTxn } // EndTransaction updates the write timestamp cache to prevent // replays. Replays for the same transaction key and timestamp will diff --git a/pkg/roachpb/data.go b/pkg/roachpb/data.go index 567559a9002e..1a16a14b840e 100644 --- a/pkg/roachpb/data.go +++ b/pkg/roachpb/data.go @@ -959,7 +959,7 @@ func (t *Transaction) BumpEpoch() { func (t *Transaction) InclusiveTimeBounds() (hlc.Timestamp, hlc.Timestamp) { min := t.OrigTimestamp max := t.Timestamp - if t.Epoch != 0 { + if t.Epoch != 0 && t.EpochZeroTimestamp != (hlc.Timestamp{}) { if min.Less(t.EpochZeroTimestamp) { panic(fmt.Sprintf("orig timestamp %s less than epoch zero %s", min, t.EpochZeroTimestamp)) } diff --git a/pkg/roachpb/errors.go b/pkg/roachpb/errors.go index 4293d735ec07..beae15cff94c 100644 --- a/pkg/roachpb/errors.go +++ b/pkg/roachpb/errors.go @@ -408,15 +408,6 @@ func NewTransactionStatusError(msg string) *TransactionStatusError { } } -// NewTransactionNotFoundStatusError initializes a new TransactionStatusError with -// a REASON_TXN_NOT_FOUND reason. -func NewTransactionNotFoundStatusError() *TransactionStatusError { - return &TransactionStatusError{ - Msg: "txn record not found", - Reason: TransactionStatusError_REASON_TXN_NOT_FOUND, - } -} - // NewTransactionCommittedStatusError initializes a new TransactionStatusError // with a REASON_TXN_COMMITTED. func NewTransactionCommittedStatusError() *TransactionStatusError { diff --git a/pkg/roachpb/errors.pb.go b/pkg/roachpb/errors.pb.go index 018fc16b84f9..b33d8c36bf9e 100644 --- a/pkg/roachpb/errors.pb.go +++ b/pkg/roachpb/errors.pb.go @@ -42,10 +42,11 @@ const ( // transaction simply pushed us, or we failed to heartbeat for a while and // another txn (of any priority) considered us abandoned and pushed us. ABORT_REASON_ABORTED_RECORD_FOUND TransactionAbortedReason = 1 - // The BeginTransaction has a timestamp below the TxnSpanGCThreshold, so there - // might have been an ABORTED txn record that got GCed (so, we might be in the - // ABORT_REASON_ABORTED_RECORD_FOUND case and not know). - ABORT_REASON_BEGIN_TOO_OLD TransactionAbortedReason = 2 + // The request attempting to create a transaction record has a timestamp below + // the TxnSpanGCThreshold, so there might have been an ABORTED txn record that + // got GCed (so, we might be in the ABORT_REASON_ABORTED_RECORD_FOUND case and + // not know). + ABORT_REASON_NEW_TXN_RECORD_TOO_OLD TransactionAbortedReason = 2 // The client is trying to use a transaction that's already been aborted. The // TxnCoordSender detects this. Either the client is misusing a txn, or the // TxnCoordSender found out about the transaction being aborted async through @@ -76,7 +77,7 @@ const ( var TransactionAbortedReason_name = map[int32]string{ 0: "ABORT_REASON_UNKNOWN", 1: "ABORT_REASON_ABORTED_RECORD_FOUND", - 2: "ABORT_REASON_BEGIN_TOO_OLD", + 2: "ABORT_REASON_NEW_TXN_RECORD_TOO_OLD", 3: "ABORT_REASON_CLIENT_REJECT", 4: "ABORT_REASON_PUSHER_ABORTED", 5: "ABORT_REASON_ABORT_SPAN", @@ -86,7 +87,7 @@ var TransactionAbortedReason_name = map[int32]string{ var TransactionAbortedReason_value = map[string]int32{ "ABORT_REASON_UNKNOWN": 0, "ABORT_REASON_ABORTED_RECORD_FOUND": 1, - "ABORT_REASON_BEGIN_TOO_OLD": 2, + "ABORT_REASON_NEW_TXN_RECORD_TOO_OLD": 2, "ABORT_REASON_CLIENT_REJECT": 3, "ABORT_REASON_PUSHER_ABORTED": 4, "ABORT_REASON_ABORT_SPAN": 5, @@ -111,7 +112,7 @@ func (x *TransactionAbortedReason) UnmarshalJSON(data []byte) error { return nil } func (TransactionAbortedReason) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{0} + return fileDescriptor_errors_72e49edf7058bee5, []int{0} } // TransactionRetryReason specifies what caused a transaction retry. @@ -126,6 +127,7 @@ const ( RETRY_SERIALIZABLE TransactionRetryReason = 3 // A possible replay caused by duplicate begin txn or out-of-order // txn sequence number. + // TODO(nvanbenschoten): This is no longer in use. Remove in 2.4. RETRY_POSSIBLE_REPLAY TransactionRetryReason = 4 // An asynchronous write was observed to have failed. RETRY_ASYNC_WRITE_FAILURE TransactionRetryReason = 5 @@ -163,7 +165,7 @@ func (x *TransactionRetryReason) UnmarshalJSON(data []byte) error { return nil } func (TransactionRetryReason) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{1} + return fileDescriptor_errors_72e49edf7058bee5, []int{1} } // TransactionRestart indicates how an error should be handled in a @@ -214,7 +216,7 @@ func (x *TransactionRestart) UnmarshalJSON(data []byte) error { return nil } func (TransactionRestart) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{2} + return fileDescriptor_errors_72e49edf7058bee5, []int{2} } // Reason specifies what caused the error. @@ -257,7 +259,7 @@ func (x *TransactionStatusError_Reason) UnmarshalJSON(data []byte) error { return nil } func (TransactionStatusError_Reason) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{9, 0} + return fileDescriptor_errors_72e49edf7058bee5, []int{9, 0} } // Reason specifies what caused the error. @@ -308,7 +310,7 @@ func (x *RangeFeedRetryError_Reason) UnmarshalJSON(data []byte) error { return nil } func (RangeFeedRetryError_Reason) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{29, 0} + return fileDescriptor_errors_72e49edf7058bee5, []int{29, 0} } // A NotLeaseHolderError indicates that the current range is not the lease @@ -337,7 +339,7 @@ func (m *NotLeaseHolderError) Reset() { *m = NotLeaseHolderError{} } func (m *NotLeaseHolderError) String() string { return proto.CompactTextString(m) } func (*NotLeaseHolderError) ProtoMessage() {} func (*NotLeaseHolderError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{0} + return fileDescriptor_errors_72e49edf7058bee5, []int{0} } func (m *NotLeaseHolderError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -374,7 +376,7 @@ func (m *NodeUnavailableError) Reset() { *m = NodeUnavailableError{} } func (m *NodeUnavailableError) String() string { return proto.CompactTextString(m) } func (*NodeUnavailableError) ProtoMessage() {} func (*NodeUnavailableError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{1} + return fileDescriptor_errors_72e49edf7058bee5, []int{1} } func (m *NodeUnavailableError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -410,7 +412,7 @@ func (m *UnsupportedRequestError) Reset() { *m = UnsupportedRequestError func (m *UnsupportedRequestError) String() string { return proto.CompactTextString(m) } func (*UnsupportedRequestError) ProtoMessage() {} func (*UnsupportedRequestError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{2} + return fileDescriptor_errors_72e49edf7058bee5, []int{2} } func (m *UnsupportedRequestError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -449,7 +451,7 @@ func (m *RangeNotFoundError) Reset() { *m = RangeNotFoundError{} } func (m *RangeNotFoundError) String() string { return proto.CompactTextString(m) } func (*RangeNotFoundError) ProtoMessage() {} func (*RangeNotFoundError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{3} + return fileDescriptor_errors_72e49edf7058bee5, []int{3} } func (m *RangeNotFoundError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -495,7 +497,7 @@ func (m *RangeKeyMismatchError) Reset() { *m = RangeKeyMismatchError{} } func (m *RangeKeyMismatchError) String() string { return proto.CompactTextString(m) } func (*RangeKeyMismatchError) ProtoMessage() {} func (*RangeKeyMismatchError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{4} + return fileDescriptor_errors_72e49edf7058bee5, []int{4} } func (m *RangeKeyMismatchError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -543,7 +545,7 @@ func (m *ReadWithinUncertaintyIntervalError) Reset() { *m = ReadWithinUn func (m *ReadWithinUncertaintyIntervalError) String() string { return proto.CompactTextString(m) } func (*ReadWithinUncertaintyIntervalError) ProtoMessage() {} func (*ReadWithinUncertaintyIntervalError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{5} + return fileDescriptor_errors_72e49edf7058bee5, []int{5} } func (m *ReadWithinUncertaintyIntervalError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -588,7 +590,7 @@ func (m *TransactionAbortedError) Reset() { *m = TransactionAbortedError func (m *TransactionAbortedError) String() string { return proto.CompactTextString(m) } func (*TransactionAbortedError) ProtoMessage() {} func (*TransactionAbortedError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{6} + return fileDescriptor_errors_72e49edf7058bee5, []int{6} } func (m *TransactionAbortedError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -626,7 +628,7 @@ func (m *TransactionPushError) Reset() { *m = TransactionPushError{} } func (m *TransactionPushError) String() string { return proto.CompactTextString(m) } func (*TransactionPushError) ProtoMessage() {} func (*TransactionPushError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{7} + return fileDescriptor_errors_72e49edf7058bee5, []int{7} } func (m *TransactionPushError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -663,7 +665,7 @@ func (m *TransactionRetryError) Reset() { *m = TransactionRetryError{} } func (m *TransactionRetryError) String() string { return proto.CompactTextString(m) } func (*TransactionRetryError) ProtoMessage() {} func (*TransactionRetryError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{8} + return fileDescriptor_errors_72e49edf7058bee5, []int{8} } func (m *TransactionRetryError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -705,7 +707,7 @@ func (m *TransactionStatusError) Reset() { *m = TransactionStatusError{} func (m *TransactionStatusError) String() string { return proto.CompactTextString(m) } func (*TransactionStatusError) ProtoMessage() {} func (*TransactionStatusError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{9} + return fileDescriptor_errors_72e49edf7058bee5, []int{9} } func (m *TransactionStatusError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -745,7 +747,7 @@ func (m *WriteIntentError) Reset() { *m = WriteIntentError{} } func (m *WriteIntentError) String() string { return proto.CompactTextString(m) } func (*WriteIntentError) ProtoMessage() {} func (*WriteIntentError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{10} + return fileDescriptor_errors_72e49edf7058bee5, []int{10} } func (m *WriteIntentError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -785,7 +787,7 @@ func (m *WriteTooOldError) Reset() { *m = WriteTooOldError{} } func (m *WriteTooOldError) String() string { return proto.CompactTextString(m) } func (*WriteTooOldError) ProtoMessage() {} func (*WriteTooOldError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{11} + return fileDescriptor_errors_72e49edf7058bee5, []int{11} } func (m *WriteTooOldError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -823,7 +825,7 @@ func (m *OpRequiresTxnError) Reset() { *m = OpRequiresTxnError{} } func (m *OpRequiresTxnError) String() string { return proto.CompactTextString(m) } func (*OpRequiresTxnError) ProtoMessage() {} func (*OpRequiresTxnError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{12} + return fileDescriptor_errors_72e49edf7058bee5, []int{12} } func (m *OpRequiresTxnError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -862,7 +864,7 @@ func (m *ConditionFailedError) Reset() { *m = ConditionFailedError{} } func (m *ConditionFailedError) String() string { return proto.CompactTextString(m) } func (*ConditionFailedError) ProtoMessage() {} func (*ConditionFailedError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{13} + return fileDescriptor_errors_72e49edf7058bee5, []int{13} } func (m *ConditionFailedError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -901,7 +903,7 @@ func (m *LeaseRejectedError) Reset() { *m = LeaseRejectedError{} } func (m *LeaseRejectedError) String() string { return proto.CompactTextString(m) } func (*LeaseRejectedError) ProtoMessage() {} func (*LeaseRejectedError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{14} + return fileDescriptor_errors_72e49edf7058bee5, []int{14} } func (m *LeaseRejectedError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -938,7 +940,7 @@ func (m *SendError) Reset() { *m = SendError{} } func (m *SendError) String() string { return proto.CompactTextString(m) } func (*SendError) ProtoMessage() {} func (*SendError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{15} + return fileDescriptor_errors_72e49edf7058bee5, []int{15} } func (m *SendError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -978,7 +980,7 @@ func (m *AmbiguousResultError) Reset() { *m = AmbiguousResultError{} } func (m *AmbiguousResultError) String() string { return proto.CompactTextString(m) } func (*AmbiguousResultError) ProtoMessage() {} func (*AmbiguousResultError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{16} + return fileDescriptor_errors_72e49edf7058bee5, []int{16} } func (m *AmbiguousResultError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1014,7 +1016,7 @@ func (m *RaftGroupDeletedError) Reset() { *m = RaftGroupDeletedError{} } func (m *RaftGroupDeletedError) String() string { return proto.CompactTextString(m) } func (*RaftGroupDeletedError) ProtoMessage() {} func (*RaftGroupDeletedError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{17} + return fileDescriptor_errors_72e49edf7058bee5, []int{17} } func (m *RaftGroupDeletedError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1054,7 +1056,7 @@ func (m *ReplicaCorruptionError) Reset() { *m = ReplicaCorruptionError{} func (m *ReplicaCorruptionError) String() string { return proto.CompactTextString(m) } func (*ReplicaCorruptionError) ProtoMessage() {} func (*ReplicaCorruptionError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{18} + return fileDescriptor_errors_72e49edf7058bee5, []int{18} } func (m *ReplicaCorruptionError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1093,7 +1095,7 @@ func (m *ReplicaTooOldError) Reset() { *m = ReplicaTooOldError{} } func (m *ReplicaTooOldError) String() string { return proto.CompactTextString(m) } func (*ReplicaTooOldError) ProtoMessage() {} func (*ReplicaTooOldError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{19} + return fileDescriptor_errors_72e49edf7058bee5, []int{19} } func (m *ReplicaTooOldError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1130,7 +1132,7 @@ func (m *StoreNotFoundError) Reset() { *m = StoreNotFoundError{} } func (m *StoreNotFoundError) String() string { return proto.CompactTextString(m) } func (*StoreNotFoundError) ProtoMessage() {} func (*StoreNotFoundError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{20} + return fileDescriptor_errors_72e49edf7058bee5, []int{20} } func (m *StoreNotFoundError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1178,7 +1180,7 @@ func (m *UnhandledRetryableError) Reset() { *m = UnhandledRetryableError func (m *UnhandledRetryableError) String() string { return proto.CompactTextString(m) } func (*UnhandledRetryableError) ProtoMessage() {} func (*UnhandledRetryableError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{21} + return fileDescriptor_errors_72e49edf7058bee5, []int{21} } func (m *UnhandledRetryableError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1232,7 +1234,7 @@ func (m *HandledRetryableTxnError) Reset() { *m = HandledRetryableTxnErr func (m *HandledRetryableTxnError) String() string { return proto.CompactTextString(m) } func (*HandledRetryableTxnError) ProtoMessage() {} func (*HandledRetryableTxnError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{22} + return fileDescriptor_errors_72e49edf7058bee5, []int{22} } func (m *HandledRetryableTxnError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1269,7 +1271,7 @@ func (m *TxnAlreadyEncounteredErrorError) Reset() { *m = TxnAlreadyEncou func (m *TxnAlreadyEncounteredErrorError) String() string { return proto.CompactTextString(m) } func (*TxnAlreadyEncounteredErrorError) ProtoMessage() {} func (*TxnAlreadyEncounteredErrorError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{23} + return fileDescriptor_errors_72e49edf7058bee5, []int{23} } func (m *TxnAlreadyEncounteredErrorError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1308,7 +1310,7 @@ func (m *IntegerOverflowError) Reset() { *m = IntegerOverflowError{} } func (m *IntegerOverflowError) String() string { return proto.CompactTextString(m) } func (*IntegerOverflowError) ProtoMessage() {} func (*IntegerOverflowError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{24} + return fileDescriptor_errors_72e49edf7058bee5, []int{24} } func (m *IntegerOverflowError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1346,7 +1348,7 @@ func (m *MixedSuccessError) Reset() { *m = MixedSuccessError{} } func (m *MixedSuccessError) String() string { return proto.CompactTextString(m) } func (*MixedSuccessError) ProtoMessage() {} func (*MixedSuccessError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{25} + return fileDescriptor_errors_72e49edf7058bee5, []int{25} } func (m *MixedSuccessError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1384,7 +1386,7 @@ func (m *BatchTimestampBeforeGCError) Reset() { *m = BatchTimestampBefor func (m *BatchTimestampBeforeGCError) String() string { return proto.CompactTextString(m) } func (*BatchTimestampBeforeGCError) ProtoMessage() {} func (*BatchTimestampBeforeGCError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{26} + return fileDescriptor_errors_72e49edf7058bee5, []int{26} } func (m *BatchTimestampBeforeGCError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1423,7 +1425,7 @@ func (m *IntentMissingError) Reset() { *m = IntentMissingError{} } func (m *IntentMissingError) String() string { return proto.CompactTextString(m) } func (*IntentMissingError) ProtoMessage() {} func (*IntentMissingError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{27} + return fileDescriptor_errors_72e49edf7058bee5, []int{27} } func (m *IntentMissingError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1462,7 +1464,7 @@ func (m *MergeInProgressError) Reset() { *m = MergeInProgressError{} } func (m *MergeInProgressError) String() string { return proto.CompactTextString(m) } func (*MergeInProgressError) ProtoMessage() {} func (*MergeInProgressError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{28} + return fileDescriptor_errors_72e49edf7058bee5, []int{28} } func (m *MergeInProgressError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1499,7 +1501,7 @@ func (m *RangeFeedRetryError) Reset() { *m = RangeFeedRetryError{} } func (m *RangeFeedRetryError) String() string { return proto.CompactTextString(m) } func (*RangeFeedRetryError) ProtoMessage() {} func (*RangeFeedRetryError) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{29} + return fileDescriptor_errors_72e49edf7058bee5, []int{29} } func (m *RangeFeedRetryError) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1565,7 +1567,7 @@ func (m *ErrorDetail) Reset() { *m = ErrorDetail{} } func (m *ErrorDetail) String() string { return proto.CompactTextString(m) } func (*ErrorDetail) ProtoMessage() {} func (*ErrorDetail) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{30} + return fileDescriptor_errors_72e49edf7058bee5, []int{30} } func (m *ErrorDetail) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2525,7 +2527,7 @@ func (m *ErrPosition) Reset() { *m = ErrPosition{} } func (m *ErrPosition) String() string { return proto.CompactTextString(m) } func (*ErrPosition) ProtoMessage() {} func (*ErrPosition) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{31} + return fileDescriptor_errors_72e49edf7058bee5, []int{31} } func (m *ErrPosition) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2581,7 +2583,7 @@ type Error struct { func (m *Error) Reset() { *m = Error{} } func (*Error) ProtoMessage() {} func (*Error) Descriptor() ([]byte, []int) { - return fileDescriptor_errors_9fc5358245dd263f, []int{32} + return fileDescriptor_errors_72e49edf7058bee5, []int{32} } func (m *Error) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -10549,181 +10551,182 @@ var ( ErrIntOverflowErrors = fmt.Errorf("proto: integer overflow") ) -func init() { proto.RegisterFile("roachpb/errors.proto", fileDescriptor_errors_9fc5358245dd263f) } +func init() { proto.RegisterFile("roachpb/errors.proto", fileDescriptor_errors_72e49edf7058bee5) } -var fileDescriptor_errors_9fc5358245dd263f = []byte{ - // 2767 bytes of a gzipped FileDescriptorProto +var fileDescriptor_errors_72e49edf7058bee5 = []byte{ + // 2773 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0xcb, 0x73, 0xdb, 0xd6, 0xd5, 0x27, 0x24, 0x4a, 0x94, 0x8e, 0x5e, 0xd0, 0xb5, 0x22, 0xc3, 0x72, 0x4c, 0xd9, 0x72, 0x1e, 0x8e, 0xbf, 0x89, 0xf4, 0x8d, 0xf3, 0x79, 0xbe, 0x89, 0x9b, 0x2c, 0xf8, 0x80, 0x44, 0x48, 0x7c, 0x28, 0x20, 0x15, 0xc7, 0x49, 0x3b, 0x18, 0x88, 0xb8, 0xa2, 0x10, 0x93, 0x00, 0x7b, 0x01, 0x58, - 0xd4, 0xae, 0xcb, 0xec, 0xda, 0xee, 0xba, 0x6b, 0x66, 0xda, 0x4d, 0xa6, 0xdb, 0x4e, 0xfe, 0x86, - 0x2c, 0xbb, 0xcc, 0x74, 0x26, 0x9e, 0xd6, 0xdd, 0x74, 0xa6, 0xff, 0x81, 0x57, 0x9d, 0xfb, 0x00, - 0x08, 0x92, 0x00, 0xc3, 0x64, 0x45, 0xe2, 0x3c, 0x7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x63, 0x4b, 0x4c, 0x3e, 0xf5, 0x06, 0x0e, 0x57, 0x30, 0x72, 0x40, 0x4f, 0x60, 0x29, 0x2c, 0x61, - 0xa2, 0x50, 0xfd, 0x98, 0x73, 0x64, 0x2f, 0xc2, 0xfe, 0x7f, 0x58, 0x6e, 0x62, 0x67, 0xb6, 0x60, - 0x47, 0x92, 0xe2, 0x0a, 0xb6, 0x0a, 0xbd, 0x73, 0xbb, 0x13, 0xb8, 0x81, 0xa7, 0x63, 0x2f, 0xe8, - 0xfa, 0xb3, 0x4d, 0xf8, 0x43, 0x58, 0xb9, 0x22, 0x66, 0xbf, 0x8f, 0x2d, 0x03, 0x13, 0x32, 0x65, - 0xca, 0x0c, 0x4e, 0x07, 0x61, 0xac, 0x92, 0x70, 0x0f, 0xef, 0xd0, 0x9b, 0xf8, 0xc2, 0x3f, 0x22, - 0x6e, 0xd0, 0x2f, 0xe3, 0x2e, 0x0e, 0x97, 0x5a, 0xa8, 0x31, 0x6c, 0x0b, 0x9e, 0x54, 0x72, 0x09, - 0x09, 0xfa, 0x74, 0xab, 0x79, 0x64, 0xf7, 0x60, 0x99, 0x51, 0x4d, 0x63, 0xfc, 0x9c, 0x2f, 0x31, - 0x71, 0xcd, 0xeb, 0xa0, 0x3d, 0x58, 0xee, 0x13, 0xb7, 0x8d, 0x3d, 0x4f, 0xec, 0xc6, 0x52, 0x54, - 0xb1, 0x42, 0x71, 0x94, 0x49, 0x48, 0x0c, 0x13, 0x3f, 0x14, 0x1f, 0x03, 0x08, 0x5a, 0x17, 0x92, - 0x93, 0x85, 0x62, 0x5e, 0xb0, 0x8c, 0x65, 0x61, 0xcf, 0x78, 0xc6, 0xf0, 0x83, 0x6e, 0x27, 0xff, - 0x1b, 0x42, 0x7f, 0x02, 0x88, 0xb1, 0x90, 0x09, 0xd6, 0x13, 0xd1, 0x17, 0xe9, 0xa7, 0xd2, 0x97, - 0x1a, 0xa5, 0x5a, 0x97, 0xa6, 0x63, 0x75, 0x69, 0xa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0x1d, 0x08, 0x47, 0x42, 0xfe, 0x84, 0x0a, - 0xb5, 0x40, 0x8e, 0xc3, 0x53, 0x2e, 0xaf, 0x2c, 0x32, 0xec, 0x77, 0xa7, 0x63, 0x47, 0xad, 0x43, - 0x25, 0xa3, 0x6f, 0xf8, 0xa3, 0x72, 0xf4, 0x14, 0x36, 0xe3, 0xa8, 0x84, 0x9e, 0x06, 0x25, 0x97, - 0xba, 0x21, 0x89, 0xed, 0x02, 0xdd, 0x10, 0x7f, 0x4c, 0x81, 0x3e, 0x87, 0xf8, 0x24, 0x68, 0x93, - 0xee, 0x07, 0x9e, 0xb2, 0xc4, 0x90, 0xdf, 0x9b, 0x99, 0xcc, 0x57, 0x32, 0x7a, 0x3c, 0x3e, 0xae, - 0x41, 0x15, 0x5a, 0x5a, 0x6c, 0x1f, 0x87, 0xa5, 0x65, 0x99, 0xa1, 0xde, 0x4f, 0x40, 0x1d, 0xe7, - 0xe6, 0x95, 0x0c, 0x2d, 0x33, 0x91, 0x0c, 0x69, 0xb0, 0xc6, 0x91, 0x7c, 0xd7, 0x35, 0x68, 0x1d, - 0x84, 0xe9, 0x50, 0x31, 0xd6, 0x11, 0x41, 0x71, 0x19, 0x3d, 0x2c, 0x6e, 0xdf, 0x20, 0x82, 0x01, - 0xb3, 0xe6, 0x6c, 0x25, 0xf5, 0xb0, 0x4c, 0x52, 0x65, 0x7a, 0x58, 0xdc, 0xb8, 0x94, 0x6e, 0x78, - 0x3b, 0x64, 0xcd, 0xc6, 0x05, 0xa3, 0xcd, 0xca, 0x6a, 0xea, 0x86, 0x27, 0x11, 0x6c, 0xba, 0xe1, - 0xed, 0x51, 0x39, 0xaa, 0xc3, 0x3a, 0xaf, 0x11, 0x44, 0x10, 0x66, 0x65, 0x2d, 0x35, 0xca, 0x49, - 0x62, 0x4d, 0xa3, 0xec, 0xc6, 0xa5, 0x34, 0x4a, 0xc7, 0xb5, 0xb0, 0x11, 0x0c, 0x5f, 0x9b, 0x94, - 0xf5, 0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52, 0x44, 0x9f, 0x6b, 0x39, 0x9d, 0xd9, 0xf2, + 0xe2, 0x72, 0xe6, 0x1b, 0x3d, 0x4a, 0x51, 0x0d, 0x8b, 0x73, 0x54, 0x45, 0x9e, 0x50, 0x5c, 0x52, + 0xe8, 0x2c, 0x2f, 0x2e, 0x49, 0x05, 0xcd, 0xe5, 0x90, 0x5f, 0x76, 0x23, 0x76, 0xab, 0xac, 0x67, + 0xe6, 0x72, 0x3a, 0x13, 0xa6, 0xb9, 0x4c, 0xae, 0x6b, 0x58, 0x8d, 0x15, 0xd8, 0x61, 0x0e, 0xa2, + 0xec, 0x1a, 0x3b, 0xc6, 0x7d, 0x59, 0x8d, 0x8d, 0x4b, 0xe9, 0x86, 0x98, 0x61, 0x87, 0x60, 0x10, + 0xd6, 0x22, 0x28, 0x5b, 0x99, 0x1b, 0x92, 0xd6, 0x4c, 0xd0, 0x0d, 0x31, 0x93, 0x72, 0x1a, 0x26, + 0xe7, 0xc1, 0xa3, 0xab, 0xe0, 0x76, 0x66, 0x98, 0xe3, 0x3c, 0x9a, 0x86, 0xe9, 0xc5, 0xa5, 0xa8, + 0x0f, 0xb7, 0x05, 0x33, 0xe6, 0x45, 0x87, 0x6e, 0x3b, 0x3d, 0x34, 0x06, 0xeb, 0x0a, 0x94, 0x37, + 0x19, 0x78, 0xda, 0x23, 0x4a, 0x16, 0x03, 0xae, 0xe5, 0x74, 0xe5, 0x3c, 0x8b, 0x1d, 0x77, 0x40, + 0xb6, 0x39, 0x61, 0x34, 0x5c, 0xc1, 0x18, 0x95, 0xed, 0xcc, 0x45, 0x49, 0xe3, 0x96, 0x74, 0x51, + 0xec, 0xa4, 0x9c, 0x56, 0xfc, 0x60, 0xf4, 0x94, 0x6a, 0x88, 0x06, 0x51, 0xb9, 0x9b, 0x59, 0xf1, + 0x33, 0x1e, 0x5e, 0x69, 0xc5, 0x0f, 0xc6, 0x54, 0xe8, 0x08, 0x56, 0x06, 0x94, 0x52, 0x1a, 0x1e, + 0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 0x3f, 0x6b, 0x56, 0x04, 0xe2, 0x7e, 0x49, 0xab, 0x9f, 0xe8, 0xaa, 0x3c, 0xc7, 0xa3, 0xdc, + 0xa1, 0x49, 0x31, 0xf3, 0xf0, 0x09, 0xa0, 0xf1, 0x53, 0x87, 0x16, 0x20, 0xdf, 0x6c, 0x35, 0x55, + 0x39, 0x87, 0x96, 0xa0, 0x40, 0x97, 0xa9, 0xb5, 0xbf, 0x2f, 0x4b, 0x68, 0x05, 0x16, 0xb5, 0x46, + 0x43, 0xad, 0x6a, 0xa5, 0x8e, 0x2a, 0xcf, 0x94, 0xef, 0x7d, 0xf7, 0x8f, 0x62, 0xee, 0xbb, 0x57, + 0x45, 0xe9, 0x2f, 0xaf, 0x8a, 0xd2, 0xf7, 0xaf, 0x8a, 0xd2, 0xdf, 0x5f, 0x15, 0xa5, 0xdf, 0xfc, + 0xb3, 0x98, 0xfb, 0xbc, 0x20, 0xb2, 0xf9, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf8, 0x1d, 0x1c, + 0x5b, 0x4d, 0x1e, 0x00, 0x00, } diff --git a/pkg/roachpb/errors.proto b/pkg/roachpb/errors.proto index 1c492541ba69..bd72a3b1f3a7 100644 --- a/pkg/roachpb/errors.proto +++ b/pkg/roachpb/errors.proto @@ -131,10 +131,11 @@ enum TransactionAbortedReason { // another txn (of any priority) considered us abandoned and pushed us. ABORT_REASON_ABORTED_RECORD_FOUND = 1; - // The BeginTransaction has a timestamp below the TxnSpanGCThreshold, so there - // might have been an ABORTED txn record that got GCed (so, we might be in the - // ABORT_REASON_ABORTED_RECORD_FOUND case and not know). - ABORT_REASON_BEGIN_TOO_OLD = 2; + // The request attempting to create a transaction record has a timestamp below + // the TxnSpanGCThreshold, so there might have been an ABORTED txn record that + // got GCed (so, we might be in the ABORT_REASON_ABORTED_RECORD_FOUND case and + // not know). + ABORT_REASON_NEW_TXN_RECORD_TOO_OLD = 2; // The client is trying to use a transaction that's already been aborted. The // TxnCoordSender detects this. Either the client is misusing a txn, or the @@ -205,6 +206,7 @@ enum TransactionRetryReason { RETRY_SERIALIZABLE = 3; // A possible replay caused by duplicate begin txn or out-of-order // txn sequence number. + // TODO(nvanbenschoten): This is no longer in use. Remove in 2.4. RETRY_POSSIBLE_REPLAY = 4; // An asynchronous write was observed to have failed. RETRY_ASYNC_WRITE_FAILURE = 5; diff --git a/pkg/storage/batcheval/cmd_begin_transaction.go b/pkg/storage/batcheval/cmd_begin_transaction.go index e86946ea9aa3..9799528c6359 100644 --- a/pkg/storage/batcheval/cmd_begin_transaction.go +++ b/pkg/storage/batcheval/cmd_begin_transaction.go @@ -40,6 +40,9 @@ func declareKeysWriteTransaction( spans.Add(spanset.SpanReadWrite, roachpb.Span{ Key: keys.TransactionKey(req.Header().Key, header.Txn.ID), }) + spans.Add(spanset.SpanReadOnly, roachpb.Span{ + Key: keys.RangeTxnSpanGCThresholdKey(header.RangeID), + }) } } @@ -47,7 +50,6 @@ func declareKeysBeginTransaction( desc roachpb.RangeDescriptor, header roachpb.Header, req roachpb.Request, spans *spanset.SpanSet, ) { declareKeysWriteTransaction(desc, header, req, spans) - spans.Add(spanset.SpanReadOnly, roachpb.Span{Key: keys.RangeTxnSpanGCThresholdKey(header.RangeID)}) spans.Add(spanset.SpanReadOnly, roachpb.Span{ Key: keys.AbortSpanKey(header.RangeID, header.Txn.ID), }) @@ -95,10 +97,12 @@ func BeginTransaction( // this command's txn and rewrite the record. reply.Txn.Update(&tmpTxn) } else { - // Our txn record already exists. This is either a client error, sending - // a duplicate BeginTransaction, or it's an artifact of DistSender - // re-sending a batch. Assume the latter and ask the client to restart. - return result.Result{}, roachpb.NewTransactionRetryError(roachpb.RETRY_POSSIBLE_REPLAY) + // Our txn record already exists. This is possible if the first + // transaction heartbeat evaluated before this BeginTransaction + // request or if the DistSender re-sent the batch. Either way, + // this request will contain no new information about the + // transaction, so treat the BeginTransaction as a no-op. + return result.Result{}, nil } case roachpb.COMMITTED: @@ -113,22 +117,11 @@ func BeginTransaction( } } - // Disallow creation or modification of a transaction record if it's at a - // timestamp before the TxnSpanGCThreshold, as in that case our transaction - // may already have been aborted by a concurrent actor which encountered one - // of our intents (which may have been written before this entry). - // - // See #9265. - threshold := cArgs.EvalCtx.GetTxnSpanGCThreshold() - if reply.Txn.LastActive().Less(threshold) { - return result.Result{}, roachpb.NewTransactionAbortedError(roachpb.ABORT_REASON_BEGIN_TOO_OLD) + // Verify that it is safe to create the transaction record. + if ok, reason := cArgs.EvalCtx.CanCreateTxnRecord(reply.Txn); !ok { + return result.Result{}, roachpb.NewTransactionAbortedError(reason) } - // Initialize the LastHeartbeat field to the present time. This allows the - // transaction record to survive for a while regardless of when the first - // heartbeat arrives. - reply.Txn.LastHeartbeat.Forward(cArgs.EvalCtx.Clock().Now()) - // Write the txn record. txnRecord := reply.Txn.AsRecord() return result.Result{}, engine.MVCCPutProto(ctx, batch, cArgs.Stats, key, hlc.Timestamp{}, nil, &txnRecord) diff --git a/pkg/storage/batcheval/cmd_end_transaction.go b/pkg/storage/batcheval/cmd_end_transaction.go index d1fb79376906..12590db987bc 100644 --- a/pkg/storage/batcheval/cmd_end_transaction.go +++ b/pkg/storage/batcheval/cmd_end_transaction.go @@ -177,91 +177,95 @@ func evalEndTransaction( ); err != nil { return result.Result{}, err } else if !ok { - if args.Commit { - return result.Result{}, roachpb.NewTransactionNotFoundStatusError() - } - // For rollbacks, we don't consider not finding the txn record an error; - // we accept without fuss rollbacks for transactions where the txn record - // was never written (because the BeginTransaction's batch failed, or - // even where the BeginTransaction was never sent to server). + // No existing transaction record was found - create one by writing it + // below in updateTxnWithExternalIntents. txn := h.Txn.Clone() reply.Txn = &txn - return result.Result{}, nil - } - // We're using existingTxn on the reply, although it can be stale - // compared to the Transaction in the request (e.g. the Sequence, - // and various timestamps). We must be careful to update it with the - // supplied ba.Txn if we return it with an error which might be - // retried, as for example to avoid client-side serializable restart. - reply.Txn = &existingTxn - - // Verify that we can either commit it or abort it (according - // to args.Commit), and also that the Timestamp and Epoch have - // not suffered regression. - switch reply.Txn.Status { - case roachpb.COMMITTED: - return result.Result{}, roachpb.NewTransactionCommittedStatusError() - - case roachpb.ABORTED: - if !args.Commit { - // The transaction has already been aborted by other. - // Do not return TransactionAbortedError since the client anyway - // wanted to abort the transaction. - desc := cArgs.EvalCtx.Desc() - externalIntents, err := resolveLocalIntents(ctx, desc, batch, ms, *args, reply.Txn, cArgs.EvalCtx) - if err != nil { - return result.Result{}, err - } - if err := updateTxnWithExternalIntents( - ctx, batch, ms, *args, reply.Txn, externalIntents, - ); err != nil { - return result.Result{}, err + + // Verify that it is safe to create the transaction record. We only need + // to perform this verification for commits. Rollbacks can always write + // an aborted txn record. + if args.Commit { + if ok, reason := cArgs.EvalCtx.CanCreateTxnRecord(reply.Txn); !ok { + return result.Result{}, roachpb.NewTransactionAbortedError(reason) } - // Use alwaysReturn==true because the transaction is definitely - // aborted, no matter what happens to this command. - return result.FromEndTxn(reply.Txn, true /* alwaysReturn */, args.Poison), nil } - // If the transaction was previously aborted by a concurrent writer's - // push, any intents written are still open. It's only now that we know - // them, so we return them all for asynchronous resolution (we're - // currently not able to write on error, but see #1989). - // - // Similarly to above, use alwaysReturn==true. The caller isn't trying - // to abort, but the transaction is definitely aborted and its intents - // can go. - reply.Txn.Intents = args.IntentSpans - return result.FromEndTxn(reply.Txn, true /* alwaysReturn */, args.Poison), - roachpb.NewTransactionAbortedError(roachpb.ABORT_REASON_ABORTED_RECORD_FOUND) - - case roachpb.PENDING: - if h.Txn.Epoch < reply.Txn.Epoch { - // TODO(tschottdorf): this leaves the Txn record (and more - // importantly, intents) dangling; we can't currently write on - // error. Would panic, but that makes TestEndTransactionWithErrors - // awkward. - return result.Result{}, roachpb.NewTransactionStatusError( - fmt.Sprintf("epoch regression: %d", h.Txn.Epoch), - ) - } else if h.Txn.Epoch == reply.Txn.Epoch && reply.Txn.Timestamp.Less(h.Txn.OrigTimestamp) { - // The transaction record can only ever be pushed forward, so it's an - // error if somehow the transaction record has an earlier timestamp - // than the original transaction timestamp. + } else { + // We're using existingTxn on the reply, although it can be stale + // compared to the Transaction in the request (e.g. the Sequence, + // and various timestamps). We must be careful to update it with the + // supplied ba.Txn if we return it with an error which might be + // retried, as for example to avoid client-side serializable restart. + reply.Txn = &existingTxn + + // Verify that we can either commit it or abort it (according + // to args.Commit), and also that the Timestamp and Epoch have + // not suffered regression. + switch reply.Txn.Status { + case roachpb.COMMITTED: + return result.Result{}, roachpb.NewTransactionCommittedStatusError() + + case roachpb.ABORTED: + if !args.Commit { + // The transaction has already been aborted by other. + // Do not return TransactionAbortedError since the client anyway + // wanted to abort the transaction. + desc := cArgs.EvalCtx.Desc() + externalIntents, err := resolveLocalIntents(ctx, desc, batch, ms, *args, reply.Txn, cArgs.EvalCtx) + if err != nil { + return result.Result{}, err + } + if err := updateTxnWithExternalIntents( + ctx, batch, ms, *args, reply.Txn, externalIntents, + ); err != nil { + return result.Result{}, err + } + // Use alwaysReturn==true because the transaction is definitely + // aborted, no matter what happens to this command. + return result.FromEndTxn(reply.Txn, true /* alwaysReturn */, args.Poison), nil + } + // If the transaction was previously aborted by a concurrent writer's + // push, any intents written are still open. It's only now that we know + // them, so we return them all for asynchronous resolution (we're + // currently not able to write on error, but see #1989). + // + // Similarly to above, use alwaysReturn==true. The caller isn't trying + // to abort, but the transaction is definitely aborted and its intents + // can go. + reply.Txn.Intents = args.IntentSpans + return result.FromEndTxn(reply.Txn, true /* alwaysReturn */, args.Poison), + roachpb.NewTransactionAbortedError(roachpb.ABORT_REASON_ABORTED_RECORD_FOUND) + + case roachpb.PENDING: + if h.Txn.Epoch < reply.Txn.Epoch { + // TODO(tschottdorf): this leaves the Txn record (and more + // importantly, intents) dangling; we can't currently write on + // error. Would panic, but that makes TestEndTransactionWithErrors + // awkward. + return result.Result{}, roachpb.NewTransactionStatusError( + fmt.Sprintf("epoch regression: %d", h.Txn.Epoch), + ) + } else if h.Txn.Epoch == reply.Txn.Epoch && reply.Txn.Timestamp.Less(h.Txn.OrigTimestamp) { + // The transaction record can only ever be pushed forward, so it's an + // error if somehow the transaction record has an earlier timestamp + // than the original transaction timestamp. + + // TODO(tschottdorf): see above comment on epoch regression. + return result.Result{}, roachpb.NewTransactionStatusError( + fmt.Sprintf("timestamp regression: %s", h.Txn.OrigTimestamp), + ) + } - // TODO(tschottdorf): see above comment on epoch regression. + default: return result.Result{}, roachpb.NewTransactionStatusError( - fmt.Sprintf("timestamp regression: %s", h.Txn.OrigTimestamp), + fmt.Sprintf("bad txn status: %s", reply.Txn), ) } - default: - return result.Result{}, roachpb.NewTransactionStatusError( - fmt.Sprintf("bad txn status: %s", reply.Txn), - ) + // Update the existing txn with the supplied txn. + reply.Txn.Update(h.Txn) } - // Update the existing txn with the supplied txn. - reply.Txn.Update(h.Txn) - var pd result.Result // Set transaction status to COMMITTED or ABORTED as per the @@ -334,9 +338,9 @@ func evalEndTransaction( } } - // Note: there's no need to clear the AbortSpan state if we've - // successfully finalized a transaction, as there's no way in which an abort - // cache entry could have been written (the txn would already have been in + // Note: there's no need to clear the AbortSpan state if we've successfully + // finalized a transaction, as there's no way in which an abort cache entry + // could have been written (the txn would already have been in // state=ABORTED). // // Summary of transaction replay protection after EndTransaction: When a @@ -344,12 +348,14 @@ func evalEndTransaction( // write will succeed but only as an intent with a newer timestamp (with a // WriteTooOldError). However, the replayed intent cannot be resolved by a // subsequent replay of this EndTransaction call because the txn timestamp - // will be too old. Replays which include a BeginTransaction never succeed + // will be too old. Replays of requests which attempt to create a new txn + // record (BeginTransaction, HeartbeatTxn, or EndTransaction) never succeed // because EndTransaction inserts in the write timestamp cache, forcing the - // BeginTransaction to fail with a transaction retry error. If the replay - // didn't include a BeginTransaction, any push will immediately succeed as a - // missing txn record on push sets the transaction to aborted. In both - // cases, the txn will be GC'd on the slow path. + // call to CanCreateTxnRecord to return false, resulting in a transaction + // retry error. If the replay didn't attempt to create a txn record, any + // push will immediately succeed as a missing txn record on push where + // CanCreateTxnRecord returns false succeeds. In both cases, the txn will + // be GC'd on the slow path. // // We specify alwaysReturn==false because if the commit fails below Raft, we // don't want the intents to be up for resolution. That should happen only diff --git a/pkg/storage/batcheval/cmd_heartbeat_txn.go b/pkg/storage/batcheval/cmd_heartbeat_txn.go index 1bbf239fc745..ee8d6ea7475d 100644 --- a/pkg/storage/batcheval/cmd_heartbeat_txn.go +++ b/pkg/storage/batcheval/cmd_heartbeat_txn.go @@ -62,11 +62,19 @@ func HeartbeatTxn( ); err != nil { return result.Result{}, err } else if !ok { - // If no existing transaction record was found, skip heartbeat. - // This could mean the heartbeat is a delayed relic or it could - // mean that the BeginTransaction call was delayed. In either - // case, there's no reason to persist a new transaction record. - return result.Result{}, roachpb.NewTransactionNotFoundStatusError() + // No existing transaction record was found - create one by writing + // it below. + txn = h.Txn.Clone() + if txn.Status != roachpb.PENDING { + return result.Result{}, roachpb.NewTransactionStatusError( + fmt.Sprintf("cannot heartbeat txn with status %v: %s", txn.Status, txn), + ) + } + + // Verify that it is safe to create the transaction record. + if ok, reason := cArgs.EvalCtx.CanCreateTxnRecord(&txn); !ok { + return result.Result{}, roachpb.NewTransactionAbortedError(reason) + } } if txn.Status == roachpb.PENDING { diff --git a/pkg/storage/batcheval/cmd_resolve_intent_test.go b/pkg/storage/batcheval/cmd_resolve_intent_test.go index e1101fd22c27..6c56b602e893 100644 --- a/pkg/storage/batcheval/cmd_resolve_intent_test.go +++ b/pkg/storage/batcheval/cmd_resolve_intent_test.go @@ -105,6 +105,11 @@ func (m *mockEvalCtx) GetMVCCStats() enginepb.MVCCStats { func (m *mockEvalCtx) GetSplitQPS() float64 { return m.qps } +func (m *mockEvalCtx) CanCreateTxnRecord( + txn *roachpb.Transaction, +) (bool, roachpb.TransactionAbortedReason) { + panic("unimplemented") +} func (m *mockEvalCtx) GetGCThreshold() hlc.Timestamp { return m.gcThreshold } diff --git a/pkg/storage/batcheval/eval_context.go b/pkg/storage/batcheval/eval_context.go index 9a39c6c28070..7c088a072817 100644 --- a/pkg/storage/batcheval/eval_context.go +++ b/pkg/storage/batcheval/eval_context.go @@ -64,6 +64,16 @@ type EvalContext interface { Desc() *roachpb.RangeDescriptor ContainsKey(key roachpb.Key) bool + // CanCreateTxnRecord determines whether a transaction record can be + // created for the provided transaction. If not, it returns the reason + // that transaction record was rejected. If the method ever determines + // that a transaction record must be rejected, it will continue to + // reject that transaction going forwards. + // + // NOTE: To call this method, a command must delare (at least) a read + // on both the transaction's key and on the txn span GC threshold key. + CanCreateTxnRecord(*roachpb.Transaction) (bool, roachpb.TransactionAbortedReason) + // GetMVCCStats returns a snapshot of the MVCC stats for the range. // If called from a command that declares a read/write span on the // entire range, the stats will be consistent with the data that is @@ -72,6 +82,7 @@ type EvalContext interface { GetMVCCStats() enginepb.MVCCStats // GetSplitQPS returns the queries/s request rate for this range. + // // NOTE: This should not be used when the load based splitting cluster // setting is disabled. GetSplitQPS() float64 diff --git a/pkg/storage/replica_eval_context_span.go b/pkg/storage/replica_eval_context_span.go index 1501d602e062..010d957d412c 100644 --- a/pkg/storage/replica_eval_context_span.go +++ b/pkg/storage/replica_eval_context_span.go @@ -142,6 +142,22 @@ func (rec SpanSetReplicaEvalContext) GetSplitQPS() float64 { return rec.i.GetSplitQPS() } +// CanCreateTxnRecord determines whether a transaction record can be created for +// the provided transaction. If not, it returns the reason that transaction +// record was rejected. If the method ever determines that a transaction record +// must be rejected, it will continue to reject that transaction going forwards. +func (rec SpanSetReplicaEvalContext) CanCreateTxnRecord( + txn *roachpb.Transaction, +) (bool, roachpb.TransactionAbortedReason) { + rec.ss.AssertAllowed(spanset.SpanReadOnly, + roachpb.Span{Key: keys.TransactionKey(txn.Key, txn.ID)}, + ) + rec.ss.AssertAllowed(spanset.SpanReadOnly, + roachpb.Span{Key: keys.RangeTxnSpanGCThresholdKey(rec.GetRangeID())}, + ) + return rec.i.CanCreateTxnRecord(txn) +} + // GetGCThreshold returns the GC threshold of the Range, typically updated when // keys are garbage collected. Reads and writes at timestamps <= this time will // not be served. diff --git a/pkg/storage/replica_test.go b/pkg/storage/replica_test.go index d35b0a6d0c2d..d4fa94308f2e 100644 --- a/pkg/storage/replica_test.go +++ b/pkg/storage/replica_test.go @@ -3063,11 +3063,9 @@ func TestReplicaAbortSpanOnlyWithIntent(t *testing.T) { args, h := heartbeatArgs(txn, tc.Clock().Now()) // If the AbortSpan were active for this request, we'd catch a txn retry. - // Instead, we expect the error from heartbeating a nonexistent txn. - _, pErr := tc.SendWrappedWith(h, &args) - if tse, ok := pErr.GetDetail().(*roachpb.TransactionStatusError); !ok || - tse.Reason != roachpb.TransactionStatusError_REASON_TXN_NOT_FOUND { - t.Fatalf("expected TransactionStatusError with REASON_TXN_NOT_FOUND, found %v", pErr) + // Instead, we expect no error and a successfully created transaction record. + if _, pErr := tc.SendWrappedWith(h, &args); pErr != nil { + t.Fatalf("unexpected error: %v", pErr) } } @@ -3256,15 +3254,37 @@ func TestEndTransactionTxnSpanGCThreshold(t *testing.T) { // we're in trouble because other written intents may have been aborted, // i.e. the transaction might commit but lose some of its writes. // - // It should not succeed because BeginTransaction checks the transaction's - // last activity against the persisted TxnSpanGCThreshold. + // It should not succeed because all request types that can create txn + // records check the transaction's original timestamp against the persisted + // TxnSpanGCThreshold. { - beginArgs, header := beginTxnArgs(key, pushee) - resp, pErr := tc.SendWrappedWith(header, &beginArgs) + expErr := "TransactionAbortedError(ABORT_REASON_NEW_TXN_RECORD_TOO_OLD)" + + // BeginTransaction. + bt, btH := beginTxnArgs(key, pushee) + resp, pErr := tc.SendWrappedWith(btH, &bt) + if pErr == nil { + t.Fatalf("unexpected success: %+v", resp) + } else if !testutils.IsPError(pErr, regexp.QuoteMeta(expErr)) { + t.Fatalf("expected %s, got %v and response %+v", expErr, pErr, resp) + } + + // HeartbeatTxn. + hb, hbH := heartbeatArgs(pushee, tc.Clock().Now()) + resp, pErr = tc.SendWrappedWith(hbH, &hb) + if pErr == nil { + t.Fatalf("unexpected success: %+v", resp) + } else if !testutils.IsPError(pErr, regexp.QuoteMeta(expErr)) { + t.Fatalf("expected %s, got %v and response %+v", expErr, pErr, resp) + } + + // EndTransaction. + et, etH := endTxnArgs(pushee, true) + resp, pErr = tc.SendWrappedWith(etH, &et) if pErr == nil { t.Fatalf("unexpected success: %+v", resp) - } else if _, ok := pErr.GetDetail().(*roachpb.TransactionAbortedError); !ok { - t.Fatalf("expected txn aborted error, got %v and response %+v", pErr, resp) + } else if !testutils.IsPError(pErr, regexp.QuoteMeta(expErr)) { + t.Fatalf("expected %s, got %v and response %+v", expErr, pErr, resp) } } @@ -3272,9 +3292,24 @@ func TestEndTransactionTxnSpanGCThreshold(t *testing.T) { // be prevented from writing its record. // See #9522. { + // BeginTransaction. txn := newTransaction("foo", key, 1, tc.Clock()) - beginArgs, header := beginTxnArgs(key, txn) - if _, pErr := tc.SendWrappedWith(header, &beginArgs); pErr != nil { + bt, btH := beginTxnArgs(key, txn) + if _, pErr := tc.SendWrappedWith(btH, &bt); pErr != nil { + t.Fatal(pErr) + } + + // HeartbeatTxn. + txn2 := newTransaction("foo", key, 1, tc.Clock()) + hb, hbH := heartbeatArgs(txn2, tc.Clock().Now()) + if _, pErr := tc.SendWrappedWith(hbH, &hb); pErr != nil { + t.Fatal(pErr) + } + + // EndTransaction. + txn3 := newTransaction("foo", key, 1, tc.Clock()) + et, etH := endTxnArgs(txn3, true) + if _, pErr := tc.SendWrappedWith(etH, &et); pErr != nil { t.Fatal(pErr) } } @@ -3415,49 +3450,55 @@ func TestEndTransactionBeforeHeartbeat(t *testing.T) { tc.Start(t, stopper) key := []byte("a") - for _, commit := range []bool{true, false} { - txn := newTransaction("test", key, 1, tc.Clock()) - _, btH := beginTxnArgs(key, txn) - put := putArgs(key, key) - assignSeqNumsForReqs(txn, &put) - beginReply, pErr := maybeWrapWithBeginTransaction(context.Background(), tc.Sender(), btH, &put) - if pErr != nil { - t.Fatal(pErr) - } - txn.Writing = true - args, h := endTxnArgs(txn, commit) - assignSeqNumsForReqs(txn, &args) - resp, pErr := tc.SendWrappedWith(h, &args) - if pErr != nil { - t.Error(pErr) - } - reply := resp.(*roachpb.EndTransactionResponse) - expStatus := roachpb.COMMITTED - if !commit { - expStatus = roachpb.ABORTED - } - if reply.Txn.Status != expStatus { - t.Errorf("expected transaction status to be %s; got %s", expStatus, reply.Txn.Status) - } + testutils.RunTrueAndFalse(t, "begin", func(t *testing.T, begin bool) { + testutils.RunTrueAndFalse(t, "commit", func(t *testing.T, commit bool) { + key = roachpb.Key(key).Next() + txn := newTransaction("test", key, 1, tc.Clock()) + txn.Writing = true - // Try a heartbeat to the already-committed transaction; should get - // committed txn back, but without last heartbeat timestamp set. - txn.Epoch++ // need to fake a higher epoch to sneak past abort span - hBA, h := heartbeatArgs(txn, tc.Clock().Now()) + var ba roachpb.BatchRequest + bt, btH := beginTxnArgs(key, txn) + put := putArgs(key, key) + assignSeqNumsForReqs(txn, &put) + ba.Header = btH + if begin { + ba.Add(&bt) + } + ba.Add(&put) + if _, pErr := tc.Sender().Send(context.Background(), ba); pErr != nil { + t.Fatal(pErr) + } - resp, pErr = tc.SendWrappedWith(h, &hBA) - if pErr != nil { - t.Error(pErr) - } - hBR := resp.(*roachpb.HeartbeatTxnResponse) - if hBR.Txn.Status != expStatus { - t.Errorf("expected transaction status to be %s, but got %s", hBR.Txn.Status, expStatus) - } - if initHeartbeat := beginReply.Header().Txn.LastHeartbeat; hBR.Txn.LastHeartbeat != initHeartbeat { - t.Errorf("expected transaction last heartbeat to be %s, but got %s", reply.Txn.LastHeartbeat, initHeartbeat) - } - key = roachpb.Key(key).Next() - } + args, h := endTxnArgs(txn, commit) + assignSeqNumsForReqs(txn, &args) + resp, pErr := tc.SendWrappedWith(h, &args) + if pErr != nil { + t.Fatal(pErr) + } + reply := resp.(*roachpb.EndTransactionResponse) + expStatus := roachpb.COMMITTED + if !commit { + expStatus = roachpb.ABORTED + } + if reply.Txn.Status != expStatus { + t.Errorf("expected transaction status to be %s; got %s", expStatus, reply.Txn.Status) + } + + // Try a heartbeat to the already-committed transaction; should get + // committed txn back, but without last heartbeat timestamp set. + txn.Epoch++ // need to fake a higher epoch to sneak past abort span + hBA, h := heartbeatArgs(txn, tc.Clock().Now()) + + resp, pErr = tc.SendWrappedWith(h, &hBA) + if pErr != nil { + t.Error(pErr) + } + hBR := resp.(*roachpb.HeartbeatTxnResponse) + if hBR.Txn.Status != expStatus { + t.Errorf("expected transaction status to be %s, but got %s", hBR.Txn.Status, expStatus) + } + }) + }) } // TestEndTransactionAfterHeartbeat verifies that a transaction @@ -3470,52 +3511,57 @@ func TestEndTransactionAfterHeartbeat(t *testing.T) { tc.Start(t, stopper) key := roachpb.Key("a") - for _, commit := range []bool{true, false} { - txn := newTransaction("test", key, 1, tc.Clock()) - _, btH := beginTxnArgs(key, txn) - put := putArgs(key, key) - assignSeqNumsForReqs(txn, &put) - beginReply, pErr := maybeWrapWithBeginTransaction(context.Background(), tc.Sender(), btH, &put) - if pErr != nil { - t.Fatal(pErr) - } + testutils.RunTrueAndFalse(t, "begin", func(t *testing.T, begin bool) { + testutils.RunTrueAndFalse(t, "commit", func(t *testing.T, commit bool) { + txn := newTransaction("test", key, 1, tc.Clock()) - // Start out with a heartbeat to the transaction. - hBA, h := heartbeatArgs(txn, tc.Clock().Now()) + var ba roachpb.BatchRequest + bt, btH := beginTxnArgs(key, txn) + put := putArgs(key, key) + assignSeqNumsForReqs(txn, &put) + ba.Header = btH + if begin { + ba.Add(&bt) + } + ba.Add(&put) + if _, pErr := tc.Sender().Send(context.Background(), ba); pErr != nil { + t.Fatal(pErr) + } - resp, pErr := tc.SendWrappedWith(h, &hBA) - if pErr != nil { - t.Fatal(pErr) - } - hBR := resp.(*roachpb.HeartbeatTxnResponse) - if hBR.Txn.Status != roachpb.PENDING { - t.Errorf("expected transaction status to be %s, but got %s", hBR.Txn.Status, roachpb.PENDING) - } - if initHeartbeat := beginReply.Header().Txn.LastHeartbeat; hBR.Txn.LastHeartbeat == initHeartbeat { - t.Errorf("expected transaction last heartbeat to advance, but it remained at %s", initHeartbeat) - } + // Start out with a heartbeat to the transaction. + hBA, h := heartbeatArgs(txn, tc.Clock().Now()) - args, h := endTxnArgs(txn, commit) - assignSeqNumsForReqs(txn, &args) + resp, pErr := tc.SendWrappedWith(h, &hBA) + if pErr != nil { + t.Fatal(pErr) + } + hBR := resp.(*roachpb.HeartbeatTxnResponse) + if hBR.Txn.Status != roachpb.PENDING { + t.Errorf("expected transaction status to be %s, but got %s", hBR.Txn.Status, roachpb.PENDING) + } - resp, pErr = tc.SendWrappedWith(h, &args) - if pErr != nil { - t.Error(pErr) - } - reply := resp.(*roachpb.EndTransactionResponse) - expStatus := roachpb.COMMITTED - if !commit { - expStatus = roachpb.ABORTED - } - if reply.Txn.Status != expStatus { - t.Errorf("expected transaction status to be %s; got %s", expStatus, reply.Txn.Status) - } - if reply.Txn.LastHeartbeat != hBR.Txn.LastHeartbeat { - t.Errorf("expected heartbeats to remain equal: %+v != %+v", - reply.Txn.LastHeartbeat, hBR.Txn.LastHeartbeat) - } - key = key.Next() - } + args, h := endTxnArgs(txn, commit) + assignSeqNumsForReqs(txn, &args) + + resp, pErr = tc.SendWrappedWith(h, &args) + if pErr != nil { + t.Error(pErr) + } + reply := resp.(*roachpb.EndTransactionResponse) + expStatus := roachpb.COMMITTED + if !commit { + expStatus = roachpb.ABORTED + } + if reply.Txn.Status != expStatus { + t.Errorf("expected transaction status to be %s; got %s", expStatus, reply.Txn.Status) + } + if reply.Txn.LastHeartbeat != hBR.Txn.LastHeartbeat { + t.Errorf("expected heartbeats to remain equal: %+v != %+v", + reply.Txn.LastHeartbeat, hBR.Txn.LastHeartbeat) + } + key = key.Next() + }) + }) } // TestEndTransactionWithPushedTimestamp verifies that txn can be @@ -3644,8 +3690,6 @@ func TestEndTransactionWithErrors(t *testing.T) { regressTS := tc.Clock().Now() txn := newTransaction("test", roachpb.Key(""), 1, tc.Clock()) - doesNotExist := roachpb.TransactionStatus(-1) - testCases := []struct { key roachpb.Key existStatus roachpb.TransactionStatus @@ -3653,7 +3697,6 @@ func TestEndTransactionWithErrors(t *testing.T) { existTS hlc.Timestamp expErrRegexp string }{ - {roachpb.Key("a"), doesNotExist, txn.Epoch, txn.Timestamp, "txn record not found"}, {roachpb.Key("a"), roachpb.COMMITTED, txn.Epoch, txn.Timestamp, "already committed"}, {roachpb.Key("b"), roachpb.ABORTED, txn.Epoch, txn.Timestamp, regexp.QuoteMeta("TransactionAbortedError(ABORT_REASON_ABORTED_RECORD_FOUND)")}, @@ -3667,13 +3710,11 @@ func TestEndTransactionWithErrors(t *testing.T) { existTxn.Status = test.existStatus existTxn.Epoch = test.existEpoch existTxn.Timestamp = test.existTS + existTxnRecord := existTxn.AsRecord() txnKey := keys.TransactionKey(test.key, txn.ID) - - if test.existStatus != doesNotExist { - if err := engine.MVCCPutProto(context.Background(), tc.repl.store.Engine(), nil, txnKey, hlc.Timestamp{}, - nil, &existTxn); err != nil { - t.Fatal(err) - } + if err := engine.MVCCPutProto(context.Background(), tc.repl.store.Engine(), nil, txnKey, hlc.Timestamp{}, + nil, &existTxnRecord); err != nil { + t.Fatal(err) } // End the transaction, verify expected error. @@ -3779,9 +3820,9 @@ func TestEndTransactionRollbackAbortedTransaction(t *testing.T) { }) } -// TestRaftReplayProtectionInTxn verifies that transactional batches -// enjoy protection from "Raft retries". -func TestRaftRetryProtectionInTxn(t *testing.T) { +// TestRPCRetryProtectionInTxn verifies that transactional batches +// enjoy protection from RPC replays. +func TestRPCRetryProtectionInTxn(t *testing.T) { defer leaktest.AfterTest(t)() cfg := TestStoreConfig(nil) tc := testContext{} @@ -3808,25 +3849,16 @@ func TestRaftRetryProtectionInTxn(t *testing.T) { t.Fatalf("unexpected error: %s", pErr) } - // We're going to attempt two retries: - // - the first one will fail because of a WriteTooOldError that pushes the - // transaction, which fails the 1PC path and forces the txn to execute - // normally at which point the WriteTooOld gets indirectly turned into a - // TransactionRetryError. - // - the second one fails because the BeginTxn is detected to be a duplicate. - for i := 0; i < 2; i++ { - // Reach in and manually send to raft (to simulate Raft retry) and - // also avoid updating the timestamp cache. - ba.Timestamp = txn.OrigTimestamp - lease, _ := tc.repl.GetLease() - ch, _, _, err := tc.repl.propose(context.Background(), lease, ba, nil, &allSpans) - if err != nil { - t.Fatalf("%d: unexpected error: %s", i, err) - } - respWithErr := <-ch - if _, ok := respWithErr.Err.GetDetail().(*roachpb.TransactionRetryError); !ok { - t.Fatalf("%d: expected TransactionRetryError; got %s", i, respWithErr.Err) - } + // Replay the request. It initially tries to execute as a 1PC transaction, + // but will fail because of a WriteTooOldError that pushes the transaction. + // This forces the txn to execute normally, at which point it fails because + // the BeginTxn is detected to be a duplicate. + _, pErr = tc.Sender().Send(context.Background(), ba) + if pErr == nil { + t.Fatalf("expected error, got nil") + } + if _, ok := pErr.GetDetail().(*roachpb.TransactionAbortedError); !ok { + t.Fatalf("expected TransactionAbortedError; got %s", pErr) } } @@ -3926,6 +3958,13 @@ func TestRaftRetryCantCommitIntents(t *testing.T) { t.Fatalf("unexpected error: %s", pErr) } + // HeartbeatTxn. + hbTxn := br.Txn.Clone() + hb, hbH := heartbeatArgs(&hbTxn, tc.Clock().Now()) + if _, pErr := tc.SendWrappedWith(hbH, &hb); pErr != nil { + t.Fatalf("unexpected error: %s", pErr) + } + // EndTransaction. etTxn := br.Txn.Clone() et, etH := endTxnArgs(&etTxn, true) @@ -3964,11 +4003,16 @@ func TestRaftRetryCantCommitIntents(t *testing.T) { t.Error(pErr) } - // EndTransaction should fail with a txn not found error. + // Heartbeat should fail with a TransactionAbortedError. + _, pErr = tc.SendWrappedWith(hbH, &hb) + if !testutils.IsPError(pErr, regexp.QuoteMeta(expErr)) { + t.Errorf("expected %s; got %v", expErr, pErr) + } + + // EndTransaction should fail with a TransactionAbortedError. _, pErr = tc.SendWrappedWith(etH, &et) - if tse, ok := pErr.GetDetail().(*roachpb.TransactionStatusError); !ok || - tse.Reason != roachpb.TransactionStatusError_REASON_TXN_NOT_FOUND { - t.Fatalf("expected TransactionStatusError with REASON_TXN_NOT_FOUND, found %v", pErr) + if !testutils.IsPError(pErr, regexp.QuoteMeta(expErr)) { + t.Errorf("expected %s; got %v", expErr, pErr) } // Expect that keyB intent did not get written! @@ -3979,9 +4023,9 @@ func TestRaftRetryCantCommitIntents(t *testing.T) { } } -// Test that a duplicate BeginTransaction results in a TransactionRetryError, as -// such recognizing that it's likely the result of the batch being retried by -// DistSender. +// Test that a duplicate BeginTransaction becomes a no-op, as such recognizing +// that it's likely the result of the batch being retried by DistSender or the +// request being evaluated after the first HeartbeatTxn. func TestDuplicateBeginTransaction(t *testing.T) { defer leaktest.AfterTest(t)() tc := testContext{} @@ -4001,8 +4045,8 @@ func TestDuplicateBeginTransaction(t *testing.T) { } // Send the batch again. _, pErr = tc.Sender().Send(context.Background(), ba) - if _, ok := pErr.GetDetail().(*roachpb.TransactionRetryError); !ok { - t.Fatalf("expected retry error; got %v", pErr) + if pErr != nil { + t.Fatal(pErr) } } @@ -8414,10 +8458,6 @@ func TestNoopRequestsNotProposed(t *testing.T) { deleteReq := &roachpb.DeleteRequest{ RequestHeader: rh, } - commitTxnReq := &roachpb.EndTransactionRequest{ - RequestHeader: rh, - Commit: true, - } pushTxnReq := &roachpb.PushTxnRequest{ RequestHeader: roachpb.RequestHeader{ Key: txn.TxnMeta.Key, @@ -8496,14 +8536,6 @@ func TestNoopRequestsNotProposed(t *testing.T) { // NB: a tombstone intent is written even if no value exists at the key. expProposal: true, }, - { - name: "failed commit txn req", - useTxn: true, - req: commitTxnReq, - expFailure: "txn record not found", - // No-op - the request fails. - expProposal: false, - }, { name: "push txn req", req: pushTxnReq, @@ -10019,6 +10051,795 @@ func TestRangeStatsRequest(t *testing.T) { require.Equal(t, expMS.LiveCount+1, resMS.LiveCount) } +// TestCreateTxnRecord tests various scenarios where a transaction attempts to +// create its transaction record. It verifies that finalized transaction records +// can never be recreated, even after they have been GCed. It also verifies that +// the effect of transaction pushes is not lost even when the push occurred before +// the trasaction record was created. +func TestCreateTxnRecord(t *testing.T) { + defer leaktest.AfterTest(t)() + + manual := hlc.NewManualClock(123) + tc := testContext{manualClock: manual} + tsc := TestStoreConfig(hlc.NewClock(manual.UnixNano, time.Nanosecond)) + tsc.TestingKnobs.DisableGCQueue = true + ctx := context.Background() + stopper := stop.NewStopper() + defer stopper.Stop(ctx) + tc.StartWithStoreConfig(t, stopper, tsc) + + pusher := newTransaction("test", roachpb.Key("a"), 1, tc.Clock()) + pusher.Priority = roachpb.MaxTxnPriority + + type runFunc func(*roachpb.Transaction, hlc.Timestamp) error + sendWrappedWithErr := func(h roachpb.Header, args roachpb.Request) error { + _, pErr := client.SendWrappedWith(ctx, tc.Sender(), h, args) + return pErr.GoError() + } + + type verifyFunc func(*roachpb.Transaction, hlc.Timestamp) roachpb.TransactionRecord + noTxnRecord := verifyFunc(nil) + txnWithoutChanges := func(txn *roachpb.Transaction, _ hlc.Timestamp) roachpb.TransactionRecord { + return txn.AsRecord() + } + txnWithStatus := func(status roachpb.TransactionStatus) verifyFunc { + return func(txn *roachpb.Transaction, _ hlc.Timestamp) roachpb.TransactionRecord { + record := txn.AsRecord() + record.Status = status + return record + } + } + + testCases := []struct { + name string + setup runFunc + run runFunc + expTxn verifyFunc + expError string // regexp pattern to match on run error, if not empty + disableTxnAutoGC bool // disables auto txn record GC + }{ + { + name: "begin transaction", + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + bt, btH := beginTxnArgs(txn.Key, txn) + return sendWrappedWithErr(btH, &bt) + }, + expTxn: txnWithoutChanges, + }, + { + name: "heartbeat transaction", + run: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + hb, hbH := heartbeatArgs(txn, now) + return sendWrappedWithErr(hbH, &hb) + }, + expTxn: func(txn *roachpb.Transaction, hbTs hlc.Timestamp) roachpb.TransactionRecord { + record := txn.AsRecord() + record.LastHeartbeat.Forward(hbTs) + return record + }, + }, + { + name: "end transaction (abort)", + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(etH, &et) + }, + // The transaction record will be eagerly GC-ed. + expTxn: noTxnRecord, + }, + { + name: "end transaction (commit)", + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + return sendWrappedWithErr(etH, &et) + }, + // The transaction record will be eagerly GC-ed. + expTxn: noTxnRecord, + }, + { + name: "end transaction (abort) without eager gc", + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(etH, &et) + }, + expTxn: txnWithStatus(roachpb.ABORTED), + disableTxnAutoGC: true, + }, + { + name: "end transaction (commit) without eager gc", + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + return sendWrappedWithErr(etH, &et) + }, + expTxn: txnWithStatus(roachpb.COMMITTED), + disableTxnAutoGC: true, + }, + { + name: "begin transaction after begin transaction", + setup: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + bt, btH := beginTxnArgs(txn.Key, txn) + return sendWrappedWithErr(btH, &bt) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + bt, btH := beginTxnArgs(txn.Key, txn) + return sendWrappedWithErr(btH, &bt) + }, + // The second begin transaction request should be treated as a no-op. + expError: "", + expTxn: txnWithoutChanges, + }, + { + name: "begin transaction after heartbeat transaction", + setup: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + hb, hbH := heartbeatArgs(txn, now) + return sendWrappedWithErr(hbH, &hb) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + bt, btH := beginTxnArgs(txn.Key, txn) + return sendWrappedWithErr(btH, &bt) + }, + // The begin transaction request should be treated as a no-op. + expError: "", + expTxn: func(txn *roachpb.Transaction, hbTs hlc.Timestamp) roachpb.TransactionRecord { + record := txn.AsRecord() + record.LastHeartbeat.Forward(hbTs) + return record + }, + }, + { + name: "heartbeat transaction after begin transaction", + setup: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + bt, btH := beginTxnArgs(txn.Key, txn) + return sendWrappedWithErr(btH, &bt) + }, + run: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + hb, hbH := heartbeatArgs(txn, now) + return sendWrappedWithErr(hbH, &hb) + }, + expTxn: func(txn *roachpb.Transaction, hbTs hlc.Timestamp) roachpb.TransactionRecord { + record := txn.AsRecord() + record.LastHeartbeat.Forward(hbTs) + return record + }, + }, + { + name: "heartbeat transaction after heartbeat transaction", + setup: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + hb, hbH := heartbeatArgs(txn, now) + return sendWrappedWithErr(hbH, &hb) + }, + run: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + hb, hbH := heartbeatArgs(txn, now.Add(0, 5)) + return sendWrappedWithErr(hbH, &hb) + }, + expTxn: func(txn *roachpb.Transaction, hbTs hlc.Timestamp) roachpb.TransactionRecord { + record := txn.AsRecord() + record.LastHeartbeat.Forward(hbTs.Add(0, 5)) + return record + }, + }, + { + name: "end transaction (abort) after begin transaction", + setup: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + bt, btH := beginTxnArgs(txn.Key, txn) + return sendWrappedWithErr(btH, &bt) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(etH, &et) + }, + // The transaction record will be eagerly GC-ed. + expTxn: noTxnRecord, + }, + { + name: "end transaction (commit) after begin transaction", + setup: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + bt, btH := beginTxnArgs(txn.Key, txn) + return sendWrappedWithErr(btH, &bt) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + return sendWrappedWithErr(etH, &et) + }, + // The transaction record will be eagerly GC-ed. + expTxn: noTxnRecord, + }, + { + name: "end transaction (abort) without eager gc after begin transaction", + setup: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + bt, btH := beginTxnArgs(txn.Key, txn) + return sendWrappedWithErr(btH, &bt) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(etH, &et) + }, + expTxn: txnWithStatus(roachpb.ABORTED), + disableTxnAutoGC: true, + }, + { + name: "end transaction (commit) without eager gc after begin transaction", + setup: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + bt, btH := beginTxnArgs(txn.Key, txn) + return sendWrappedWithErr(btH, &bt) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + return sendWrappedWithErr(etH, &et) + }, + expTxn: txnWithStatus(roachpb.COMMITTED), + disableTxnAutoGC: true, + }, + { + name: "begin transaction after end transaction (abort)", + setup: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(etH, &et) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + bt, btH := beginTxnArgs(txn.Key, txn) + return sendWrappedWithErr(btH, &bt) + }, + expError: "TransactionAbortedError(ABORT_REASON_ALREADY_COMMITTED_OR_ROLLED_BACK_POSSIBLE_REPLAY)", + expTxn: noTxnRecord, + }, + { + name: "begin transaction after end transaction (commit)", + setup: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + return sendWrappedWithErr(etH, &et) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + bt, btH := beginTxnArgs(txn.Key, txn) + return sendWrappedWithErr(btH, &bt) + }, + expError: "TransactionAbortedError(ABORT_REASON_ALREADY_COMMITTED_OR_ROLLED_BACK_POSSIBLE_REPLAY)", + expTxn: noTxnRecord, + }, + { + name: "begin transaction after end transaction (abort) without eager gc", + setup: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(etH, &et) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + bt, btH := beginTxnArgs(txn.Key, txn) + return sendWrappedWithErr(btH, &bt) + }, + expError: "TransactionAbortedError(ABORT_REASON_ABORTED_RECORD_FOUND)", + expTxn: txnWithStatus(roachpb.ABORTED), + disableTxnAutoGC: true, + }, + { + name: "begin transaction after end transaction (commit) without eager gc", + setup: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + return sendWrappedWithErr(etH, &et) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + bt, btH := beginTxnArgs(txn.Key, txn) + return sendWrappedWithErr(btH, &bt) + }, + expError: "TransactionStatusError: BeginTransaction can't overwrite", + expTxn: txnWithStatus(roachpb.COMMITTED), + disableTxnAutoGC: true, + }, + { + name: "heartbeat transaction after end transaction (abort)", + setup: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(etH, &et) + }, + run: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + hb, hbH := heartbeatArgs(txn, now) + return sendWrappedWithErr(hbH, &hb) + }, + expError: "TransactionAbortedError(ABORT_REASON_ALREADY_COMMITTED_OR_ROLLED_BACK_POSSIBLE_REPLAY)", + expTxn: noTxnRecord, + }, + { + name: "heartbeat transaction after end transaction (abort) and restart", + setup: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(etH, &et) + }, + run: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + // Restart the transaction at a higher timestamp. This will + // increment its OrigTimestamp as well. We used to check the GC + // threshold against this timestamp instead of its epoch zero + // timestamp. + clone := txn.Clone() + clone.Restart(1, 0, now.Add(0, 1)) + hb, hbH := heartbeatArgs(&clone, now) + return sendWrappedWithErr(hbH, &hb) + }, + expError: "TransactionAbortedError(ABORT_REASON_ALREADY_COMMITTED_OR_ROLLED_BACK_POSSIBLE_REPLAY)", + expTxn: noTxnRecord, + }, + { + name: "heartbeat transaction after end transaction (commit)", + setup: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + return sendWrappedWithErr(etH, &et) + }, + run: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + hb, hbH := heartbeatArgs(txn, now) + return sendWrappedWithErr(hbH, &hb) + }, + expError: "TransactionAbortedError(ABORT_REASON_ALREADY_COMMITTED_OR_ROLLED_BACK_POSSIBLE_REPLAY)", + expTxn: noTxnRecord, + }, + { + name: "heartbeat transaction after end transaction (abort) without eager gc", + setup: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(etH, &et) + }, + run: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + hb, hbH := heartbeatArgs(txn, now) + return sendWrappedWithErr(hbH, &hb) + }, + // The heartbeat request won't throw an error, but also won't update the + // transaction record. It will simply return the updated transaction state. + // This is kind of strange, but also doesn't cause any issues. + expError: "", + expTxn: txnWithStatus(roachpb.ABORTED), + disableTxnAutoGC: true, + }, + { + name: "heartbeat transaction after end transaction (commit) without eager gc", + setup: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + return sendWrappedWithErr(etH, &et) + }, + run: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + hb, hbH := heartbeatArgs(txn, now) + return sendWrappedWithErr(hbH, &hb) + }, + // The heartbeat request won't throw an error, but also won't update the + // transaction record. It will simply return the updated transaction state. + // This is kind of strange, but also doesn't cause any issues. + expError: "", + expTxn: txnWithStatus(roachpb.COMMITTED), + disableTxnAutoGC: true, + }, + { + // Could be a replay or a retry. + name: "end transaction (abort) after end transaction (abort)", + setup: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(etH, &et) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(etH, &et) + }, + expTxn: noTxnRecord, + }, + { + // This case shouldn't happen in practice given a well-functioning + // transaction coordinator, but is handled correctly nevertheless. + name: "end transaction (abort) after end transaction (commit)", + setup: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + return sendWrappedWithErr(etH, &et) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(etH, &et) + }, + expTxn: noTxnRecord, + }, + { + // This case shouldn't happen in practice given a well-functioning + // transaction coordinator, but is handled correctly nevertheless. + name: "end transaction (commit) after end transaction (abort)", + setup: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(etH, &et) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + return sendWrappedWithErr(etH, &et) + }, + expError: "TransactionAbortedError(ABORT_REASON_ALREADY_COMMITTED_OR_ROLLED_BACK_POSSIBLE_REPLAY)", + expTxn: noTxnRecord, + }, + { + // Could be a replay or a retry. + name: "end transaction (commit) after end transaction (commit)", + setup: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + return sendWrappedWithErr(etH, &et) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + return sendWrappedWithErr(etH, &et) + }, + expError: "TransactionAbortedError(ABORT_REASON_ALREADY_COMMITTED_OR_ROLLED_BACK_POSSIBLE_REPLAY)", + expTxn: noTxnRecord, + }, + { + // Could be a replay or a retry. + name: "end transaction (abort) after end transaction (abort) without eager gc", + setup: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(etH, &et) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(etH, &et) + }, + expTxn: txnWithStatus(roachpb.ABORTED), + disableTxnAutoGC: true, + }, + { + // This case shouldn't happen in practice given a well-functioning + // transaction coordinator, but is handled correctly nevertheless. + name: "end transaction (abort) after end transaction (commit) without eager gc", + setup: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + return sendWrappedWithErr(etH, &et) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(etH, &et) + }, + expError: "TransactionStatusError: already committed (REASON_TXN_COMMITTED)", + expTxn: txnWithStatus(roachpb.COMMITTED), + disableTxnAutoGC: true, + }, + { + // This case shouldn't happen in practice given a well-functioning + // transaction coordinator, but is handled correctly nevertheless. + name: "end transaction (commit) after end transaction (abort) without eager gc", + setup: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(etH, &et) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + return sendWrappedWithErr(etH, &et) + }, + expError: "TransactionAbortedError(ABORT_REASON_ABORTED_RECORD_FOUND)", + expTxn: txnWithStatus(roachpb.ABORTED), + disableTxnAutoGC: true, + }, + { + // Could be a replay or a retry. + name: "end transaction (commit) after end transaction (commit) without eager gc", + setup: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + return sendWrappedWithErr(etH, &et) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + return sendWrappedWithErr(etH, &et) + }, + expError: "TransactionStatusError: already committed (REASON_TXN_COMMITTED)", + expTxn: txnWithStatus(roachpb.COMMITTED), + disableTxnAutoGC: true, + }, + { + name: "begin transaction after push timestamp", + setup: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + pt := pushTxnArgs(pusher, txn, roachpb.PUSH_TIMESTAMP) + pt.PushTo = now + pt.Now = now + return sendWrappedWithErr(roachpb.Header{}, &pt) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + bt, btH := beginTxnArgs(txn.Key, txn) + return sendWrappedWithErr(btH, &bt) + }, + expError: "TransactionAbortedError(ABORT_REASON_ABORTED_RECORD_FOUND)", + expTxn: func(txn *roachpb.Transaction, pushTs hlc.Timestamp) roachpb.TransactionRecord { + record := txn.AsRecord() + record.Status = roachpb.ABORTED + record.Timestamp = pushTs + record.OrigTimestamp = pushTs + record.LastHeartbeat = hlc.Timestamp{} + return record + }, + }, + { + name: "heartbeat transaction after push timestamp", + setup: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + pt := pushTxnArgs(pusher, txn, roachpb.PUSH_TIMESTAMP) + pt.PushTo = now + pt.Now = now + return sendWrappedWithErr(roachpb.Header{}, &pt) + }, + run: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + hb, hbH := heartbeatArgs(txn, now) + return sendWrappedWithErr(hbH, &hb) + }, + // The heartbeat request won't throw an error, but also won't update the + // transaction record. It will simply return the updated transaction state. + // This is kind of strange, but also doesn't cause any issues. + expError: "", + expTxn: func(txn *roachpb.Transaction, pushTs hlc.Timestamp) roachpb.TransactionRecord { + record := txn.AsRecord() + record.Status = roachpb.ABORTED + record.Timestamp = pushTs + record.OrigTimestamp = pushTs + record.LastHeartbeat = hlc.Timestamp{} + return record + }, + }, + { + name: "end transaction (abort) after push timestamp", + setup: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + pt := pushTxnArgs(pusher, txn, roachpb.PUSH_TIMESTAMP) + pt.PushTo = now + pt.Now = now + return sendWrappedWithErr(roachpb.Header{}, &pt) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(etH, &et) + }, + // The end transaction (abort) request succeeds and cleans up the + // transaction record. + expTxn: noTxnRecord, + }, + { + name: "end transaction (commit) after push timestamp", + setup: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + pt := pushTxnArgs(pusher, txn, roachpb.PUSH_TIMESTAMP) + pt.PushTo = now + pt.Now = now + return sendWrappedWithErr(roachpb.Header{}, &pt) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + return sendWrappedWithErr(etH, &et) + }, + expError: "TransactionAbortedError(ABORT_REASON_ABORTED_RECORD_FOUND)", + expTxn: func(txn *roachpb.Transaction, pushTs hlc.Timestamp) roachpb.TransactionRecord { + record := txn.AsRecord() + record.Status = roachpb.ABORTED + record.Timestamp = pushTs + record.OrigTimestamp = pushTs + record.LastHeartbeat = hlc.Timestamp{} + return record + }, + }, + { + name: "begin transaction after push abort", + setup: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + pt := pushTxnArgs(pusher, txn, roachpb.PUSH_ABORT) + pt.Now = now + return sendWrappedWithErr(roachpb.Header{}, &pt) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + bt, btH := beginTxnArgs(txn.Key, txn) + return sendWrappedWithErr(btH, &bt) + }, + expError: "TransactionAbortedError(ABORT_REASON_ABORTED_RECORD_FOUND)", + expTxn: func(txn *roachpb.Transaction, pushTs hlc.Timestamp) roachpb.TransactionRecord { + record := txn.AsRecord() + record.Status = roachpb.ABORTED + record.Timestamp = pushTs + record.OrigTimestamp = pushTs + record.LastHeartbeat = hlc.Timestamp{} + return record + }, + }, + { + name: "heartbeat transaction after push abort", + setup: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + pt := pushTxnArgs(pusher, txn, roachpb.PUSH_ABORT) + pt.Now = now + return sendWrappedWithErr(roachpb.Header{}, &pt) + }, + run: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + hb, hbH := heartbeatArgs(txn, now) + return sendWrappedWithErr(hbH, &hb) + }, + // The heartbeat request won't throw an error, but also won't update the + // transaction record. It will simply return the updated transaction state. + // This is kind of strange, but also doesn't cause any issues. + expError: "", + expTxn: func(txn *roachpb.Transaction, pushTs hlc.Timestamp) roachpb.TransactionRecord { + record := txn.AsRecord() + record.Status = roachpb.ABORTED + record.Timestamp = pushTs + record.OrigTimestamp = pushTs + record.LastHeartbeat = hlc.Timestamp{} + return record + }, + }, + { + name: "heartbeat transaction after push abort and restart", + setup: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + pt := pushTxnArgs(pusher, txn, roachpb.PUSH_ABORT) + pt.Now = now + return sendWrappedWithErr(roachpb.Header{}, &pt) + }, + run: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + // Restart the transaction at a higher timestamp. This will + // increment its OrigTimestamp as well. We used to check the GC + // threshold against this timestamp instead of its epoch zero + // timestamp. + clone := txn.Clone() + clone.Restart(1, 0, now.Add(0, 1)) + hb, hbH := heartbeatArgs(&clone, now) + return sendWrappedWithErr(hbH, &hb) + }, + // The heartbeat request won't throw an error, but also won't update the + // transaction record. It will simply return the updated transaction state. + // This is kind of strange, but also doesn't cause any issues. + expError: "", + expTxn: func(txn *roachpb.Transaction, pushTs hlc.Timestamp) roachpb.TransactionRecord { + record := txn.AsRecord() + record.Status = roachpb.ABORTED + record.Timestamp = pushTs + record.OrigTimestamp = pushTs + record.LastHeartbeat = hlc.Timestamp{} + return record + }, + }, + { + name: "end transaction (abort) after push abort", + setup: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + pt := pushTxnArgs(pusher, txn, roachpb.PUSH_ABORT) + pt.Now = now + return sendWrappedWithErr(roachpb.Header{}, &pt) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(etH, &et) + }, + // The end transaction (abort) request succeeds and cleans up the + // transaction record. + expTxn: noTxnRecord, + }, + { + name: "end transaction (commit) after push abort", + setup: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + pt := pushTxnArgs(pusher, txn, roachpb.PUSH_ABORT) + pt.Now = now + return sendWrappedWithErr(roachpb.Header{}, &pt) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + return sendWrappedWithErr(etH, &et) + }, + expError: "TransactionAbortedError(ABORT_REASON_ABORTED_RECORD_FOUND)", + expTxn: func(txn *roachpb.Transaction, pushTs hlc.Timestamp) roachpb.TransactionRecord { + record := txn.AsRecord() + record.Status = roachpb.ABORTED + record.Timestamp = pushTs + record.OrigTimestamp = pushTs + record.LastHeartbeat = hlc.Timestamp{} + return record + }, + }, + { + name: "begin transaction after gc", + setup: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + gc := gcArgs([]byte("a"), []byte("z")) + gc.TxnSpanGCThreshold = now + return sendWrappedWithErr(roachpb.Header{}, &gc) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + bt, btH := beginTxnArgs(txn.Key, txn) + return sendWrappedWithErr(btH, &bt) + }, + expError: "TransactionAbortedError(ABORT_REASON_NEW_TXN_RECORD_TOO_OLD)", + expTxn: noTxnRecord, + }, + { + name: "heartbeat transaction after gc", + setup: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + gc := gcArgs([]byte("a"), []byte("z")) + gc.TxnSpanGCThreshold = now + return sendWrappedWithErr(roachpb.Header{}, &gc) + }, + run: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + hb, hbH := heartbeatArgs(txn, now) + return sendWrappedWithErr(hbH, &hb) + }, + expError: "TransactionAbortedError(ABORT_REASON_NEW_TXN_RECORD_TOO_OLD)", + expTxn: noTxnRecord, + }, + { + name: "heartbeat transaction after gc and restart", + setup: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + gc := gcArgs([]byte("a"), []byte("z")) + gc.TxnSpanGCThreshold = now + return sendWrappedWithErr(roachpb.Header{}, &gc) + }, + run: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + // Restart the transaction at a higher timestamp. This will + // increment its OrigTimestamp as well. We used to check the GC + // threshold against this timestamp instead of its epoch zero + // timestamp. + clone := txn.Clone() + clone.Restart(1, 0, now.Add(0, 1)) + hb, hbH := heartbeatArgs(&clone, now) + return sendWrappedWithErr(hbH, &hb) + }, + expError: "TransactionAbortedError(ABORT_REASON_NEW_TXN_RECORD_TOO_OLD)", + expTxn: noTxnRecord, + }, + { + name: "end transaction (abort) after gc", + setup: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + gc := gcArgs([]byte("a"), []byte("z")) + gc.TxnSpanGCThreshold = now + return sendWrappedWithErr(roachpb.Header{}, &gc) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, false /* commit */) + return sendWrappedWithErr(etH, &et) + }, + expTxn: noTxnRecord, + }, + { + name: "end transaction (commit) after gc", + setup: func(txn *roachpb.Transaction, now hlc.Timestamp) error { + gc := gcArgs([]byte("a"), []byte("z")) + gc.TxnSpanGCThreshold = now + return sendWrappedWithErr(roachpb.Header{}, &gc) + }, + run: func(txn *roachpb.Transaction, _ hlc.Timestamp) error { + et, etH := endTxnArgs(txn, true /* commit */) + return sendWrappedWithErr(etH, &et) + }, + expError: "TransactionAbortedError(ABORT_REASON_NEW_TXN_RECORD_TOO_OLD)", + expTxn: noTxnRecord, + }, + } + for _, c := range testCases { + t.Run(c.name, func(t *testing.T) { + defer setTxnAutoGC(!c.disableTxnAutoGC)() + + txn := newTransaction(c.name, roachpb.Key(c.name), 1, tc.Clock()) + runTs := tc.Clock().Now() + if c.setup != nil { + if err := c.setup(txn, runTs); err != nil { + t.Fatalf("failed during test setup: %v", err) + } + } + + if err := c.run(txn, runTs); err != nil { + if len(c.expError) == 0 { + t.Fatalf("expected no failure, found %q", err.Error()) + } + if !testutils.IsError(err, regexp.QuoteMeta(c.expError)) { + t.Fatalf("expected failure %q, found %q", c.expError, err.Error()) + } + } else { + if len(c.expError) > 0 { + t.Fatalf("expected failure %q", c.expError) + } + } + + var foundRecord roachpb.TransactionRecord + if found, err := engine.MVCCGetProto( + ctx, tc.repl.store.Engine(), keys.TransactionKey(txn.Key, txn.ID), + hlc.Timestamp{}, &foundRecord, engine.MVCCGetOptions{}, + ); err != nil { + t.Fatal(err) + } else if found { + if c.expTxn == nil { + t.Fatalf("expected no txn record, found %v", found) + } + expRecord := c.expTxn(txn, runTs) + if !reflect.DeepEqual(expRecord, foundRecord) { + t.Fatalf("expected txn record %v, found %v", expRecord, foundRecord) + } + } else { + if c.expTxn != nil { + t.Fatalf("expected txn record, found no txn record") + } + } + }) + } +} + // Test that an EndTransaction(commit=false) request that doesn't find its // transaction record doesn't return an error. // This is relied upon by the client which liberally sends rollbacks even when @@ -10033,13 +10854,11 @@ func TestRollbackMissingTxnRecordNoError(t *testing.T) { tc.Start(t, stopper) key := roachpb.Key("bogus key") - txn := roachpb.MakeTransaction("test", key, - roachpb.NormalUserPriority, - tc.Clock().Now(), tc.Clock().MaxOffset().Nanoseconds()) + txn := newTransaction("test", key, roachpb.NormalUserPriority, tc.Clock()) res, pErr := client.SendWrappedWith(ctx, tc.Sender(), roachpb.Header{ RangeID: tc.repl.RangeID, - Txn: &txn, + Txn: txn, }, &roachpb.EndTransactionRequest{ RequestHeader: roachpb.RequestHeader{ Key: key, @@ -10057,7 +10876,7 @@ func TestRollbackMissingTxnRecordNoError(t *testing.T) { // a BeginTransaction arriving after the rollback. _, pErr = client.SendWrappedWith(ctx, tc.Sender(), roachpb.Header{ RangeID: tc.repl.RangeID, - Txn: &txn, + Txn: txn, }, &roachpb.BeginTransactionRequest{ RequestHeader: roachpb.RequestHeader{ Key: key, diff --git a/pkg/storage/replica_tscache.go b/pkg/storage/replica_tscache.go index 3d9aa6ed32c8..564d9d59099b 100644 --- a/pkg/storage/replica_tscache.go +++ b/pkg/storage/replica_tscache.go @@ -65,8 +65,14 @@ func (r *Replica) updateTimestampCache( switch t := args.(type) { case *roachpb.EndTransactionRequest: // EndTransaction adds the transaction key to the write - // timestamp cache to ensure replays create a transaction - // record with WriteTooOld set. + // timestamp cache as a tombstone to ensure replays and + // concurrent requests aren't able to create a new + // transaction record. + // + // It inserts the timestamp of the final batch in the + // transaction. This timestamp must necessarily be equal + // to or greater than the transaction's OrigTimestamp, + // which is consulted in CanCreateTxnRecord. key := keys.TransactionKey(start, txnID) tc.Add(key, nil, ts, txnID, false /* readCache */) case *roachpb.ConditionalPutRequest: @@ -157,51 +163,6 @@ func (r *Replica) applyTimestampCache( args := union.GetInner() if roachpb.ConsultsTimestampCache(args) { header := args.Header() - // BeginTransaction is a special case. We use the transaction - // key to look for an entry which would indicate this transaction - // has already been finalized, in which case this BeginTxn might be a - // replay (it might also be delayed, coming in behind an async EndTxn). - // If the request hits the timestamp cache, then we return a retriable - // error: if this is a re-evaluation, then the error will be transformed - // into an ambiguous one higher up. Otherwise, if the client is still - // waiting for a result, then this cannot be a "replay" of any sort. - // - // The retriable error we return is a TransactionAbortedError, instructing - // the client to create a new transaction. Since a transaction record - // doesn't exist, there's no point in the client to continue with the - // existing transaction at a new epoch. - if _, ok := args.(*roachpb.BeginTransactionRequest); ok { - key := keys.TransactionKey(header.Key, ba.Txn.ID) - wTS, wTxnID := r.store.tsCache.GetMaxWrite(key, nil /* end */) - // GetMaxWrite will only find a timestamp interval with an - // associated txnID on the TransactionKey if an EndTxnReq has - // been processed. All other timestamp intervals will have no - // associated txnID and will be due to the low-water mark. - switch wTxnID { - case ba.Txn.ID: - newTxn := ba.Txn.Clone() - newTxn.Status = roachpb.ABORTED - newTxn.Timestamp.Forward(wTS.Next()) - return false, roachpb.NewErrorWithTxn(roachpb.NewTransactionAbortedError( - roachpb.ABORT_REASON_ALREADY_COMMITTED_OR_ROLLED_BACK_POSSIBLE_REPLAY), &newTxn) - case uuid.UUID{} /* noTxnID */ : - if !wTS.Less(ba.Txn.Timestamp) { - // On lease transfers the timestamp cache is reset with the transfer - // time as the low-water mark, so if this replica recently obtained - // the lease, this case will be true for new txns, even if they're - // not a replay. We move the timestamp forward and return retry. - newTxn := ba.Txn.Clone() - newTxn.Status = roachpb.ABORTED - newTxn.Timestamp.Forward(wTS.Next()) - return false, roachpb.NewErrorWithTxn(roachpb.NewTransactionAbortedError( - roachpb.ABORT_REASON_TIMESTAMP_CACHE_REJECTED_POSSIBLE_REPLAY), &newTxn) - } - default: - log.Fatalf(ctx, "unexpected tscache interval (%s,%s) on TxnKey %s", - wTS, wTxnID, key) - } - continue - } // Forward the timestamp if there's been a more recent read (by someone else). rTS, rTxnID := r.store.tsCache.GetMaxRead(header.Key, header.EndKey) @@ -242,3 +203,58 @@ func (r *Replica) applyTimestampCache( } return bumped, nil } + +// CanCreateTxnRecord determines whether a transaction record can be created +// for the provided transaction. If not, it returns the reason that transaction +// record was rejected. If the method ever determines that a transaction record +// must be rejected, it will continue to reject that transaction going forwards. +func (r *Replica) CanCreateTxnRecord( + txn *roachpb.Transaction, +) (bool, roachpb.TransactionAbortedReason) { + // We make comparisons below against the epoch zero timestamp because the + // transaction's provisional commit timestamp may be moved forward over the + // course of a single epoch and its original timestamp may have moved + // forward over the course of a series of epochs. + minTxnTS, _ := txn.InclusiveTimeBounds() + + // We look in the timestamp cache to see if there is an entry for this + // transaction, which would indicate this transaction has already been + // finalized. If there is an entry, then we return a retriable error: if + // this is a re-evaluation, then the error will be transformed into an + // ambiguous one higher up. Otherwise, if the client is still waiting for a + // result, then this cannot be a "replay" of any sort. + key := keys.TransactionKey(txn.Key, txn.ID) + wTS, wTxnID := r.store.tsCache.GetMaxWrite(key, nil /* end */) + // GetMaxWrite will only find a timestamp interval with an associated txnID + // on the TransactionKey if an EndTxnReq has been processed. All other + // timestamp intervals will have no associated txnID and will be due to the + // low-water mark. + switch wTxnID { + case txn.ID: + return false, roachpb.ABORT_REASON_ALREADY_COMMITTED_OR_ROLLED_BACK_POSSIBLE_REPLAY + case uuid.UUID{} /* noTxnID */ : + if !wTS.Less(minTxnTS) { + // On lease transfers the timestamp cache is reset with the transfer + // time as the low-water mark, so if this replica recently obtained + // the lease, this case will be true for new txns, even if they're + // not a replay. We force these txns to retry. + return false, roachpb.ABORT_REASON_TIMESTAMP_CACHE_REJECTED_POSSIBLE_REPLAY + } + default: + log.Fatalf(context.Background(), "unexpected tscache interval (%s,%s) for txn %s", + wTS, wTxnID, txn) + } + + // Disallow creation or modification of a transaction record if its original + // timestamp is before the TxnSpanGCThreshold, as in that case our transaction + // may already have been aborted by a concurrent actor which encountered one + // of our intents (which may have been written before our transaction record). + // + // See #9265. + threshold := r.GetTxnSpanGCThreshold() + if minTxnTS.Less(threshold) { + return false, roachpb.ABORT_REASON_NEW_TXN_RECORD_TOO_OLD + } + + return true, 0 +}