From 1eb3b2a62470bd3c3ee3f64f6c4118900961ec9f Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Wed, 14 Nov 2018 11:50:38 -0500 Subject: [PATCH] batcheval: Disable use of time-bound iterators in KV commands This optimization has not been shown to make a difference in benchmarks, and there are doubts about its correctness (#28358). It is still used for CDC (where it does make a difference) and incremental backups. Release note: None --- pkg/storage/batcheval/cmd_end_transaction.go | 5 +---- pkg/storage/batcheval/cmd_refresh_range.go | 6 +----- pkg/storage/batcheval/cmd_resolve_intent_range.go | 14 +------------- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/pkg/storage/batcheval/cmd_end_transaction.go b/pkg/storage/batcheval/cmd_end_transaction.go index 649e83d2a8b9..7cdae20925e6 100644 --- a/pkg/storage/batcheval/cmd_end_transaction.go +++ b/pkg/storage/batcheval/cmd_end_transaction.go @@ -440,11 +440,8 @@ func resolveLocalIntents( desc = &mergeTrigger.LeftDesc } - min, max := txn.InclusiveTimeBounds() iter := batch.NewIterator(engine.IterOptions{ - MinTimestampHint: min, - MaxTimestampHint: max, - UpperBound: desc.EndKey.AsRawKey(), + UpperBound: desc.EndKey.AsRawKey(), }) iterAndBuf := engine.GetBufUsingIter(iter) defer iterAndBuf.Cleanup() diff --git a/pkg/storage/batcheval/cmd_refresh_range.go b/pkg/storage/batcheval/cmd_refresh_range.go index b25b6a0100da..291fb38a7dd8 100644 --- a/pkg/storage/batcheval/cmd_refresh_range.go +++ b/pkg/storage/batcheval/cmd_refresh_range.go @@ -42,12 +42,8 @@ func RefreshRange( return result.Result{}, errors.Errorf("no transaction specified to %s", args.Method()) } - // Use a time-bounded iterator to avoid unnecessarily iterating over - // older data. iter := batch.NewIterator(engine.IterOptions{ - MinTimestampHint: h.Txn.OrigTimestamp, - MaxTimestampHint: h.Txn.Timestamp, - UpperBound: args.EndKey, + UpperBound: args.EndKey, }) defer iter.Close() // Iterate over values until we discover any value written at or diff --git a/pkg/storage/batcheval/cmd_resolve_intent_range.go b/pkg/storage/batcheval/cmd_resolve_intent_range.go index 4696f47fefb9..9ff395861bc2 100644 --- a/pkg/storage/batcheval/cmd_resolve_intent_range.go +++ b/pkg/storage/batcheval/cmd_resolve_intent_range.go @@ -21,7 +21,6 @@ import ( "github.com/cockroachdb/cockroach/pkg/storage/batcheval/result" "github.com/cockroachdb/cockroach/pkg/storage/engine" "github.com/cockroachdb/cockroach/pkg/storage/spanset" - "github.com/cockroachdb/cockroach/pkg/util/hlc" ) func init() { @@ -53,18 +52,7 @@ func ResolveIntentRange( Status: args.Status, } - // Use a time-bounded iterator as an optimization if indicated. - var iterAndBuf engine.IterAndBuf - if args.MinTimestamp != (hlc.Timestamp{}) { - iter := batch.NewIterator(engine.IterOptions{ - MinTimestampHint: args.MinTimestamp, - MaxTimestampHint: args.IntentTxn.Timestamp, - UpperBound: args.EndKey, - }) - iterAndBuf = engine.GetBufUsingIter(iter) - } else { - iterAndBuf = engine.GetIterAndBuf(batch, engine.IterOptions{UpperBound: args.EndKey}) - } + iterAndBuf := engine.GetIterAndBuf(batch, engine.IterOptions{UpperBound: args.EndKey}) defer iterAndBuf.Cleanup() numKeys, resumeSpan, err := engine.MVCCResolveWriteIntentRangeUsingIter(