Skip to content

Commit

Permalink
batcheval: Disable use of time-bound iterators in KV commands
Browse files Browse the repository at this point in the history
This optimization has not been shown to make a difference in
benchmarks, and there are doubts about its correctness (cockroachdb#28358). It is
still used for CDC (where it does make a difference) and incremental
backups.

Release note: None
  • Loading branch information
bdarnell committed Nov 14, 2018
1 parent bac0559 commit 1eb3b2a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 22 deletions.
5 changes: 1 addition & 4 deletions pkg/storage/batcheval/cmd_end_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 1 addition & 5 deletions pkg/storage/batcheval/cmd_refresh_range.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 1 addition & 13 deletions pkg/storage/batcheval/cmd_resolve_intent_range.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 1eb3b2a

Please sign in to comment.