Skip to content

Commit

Permalink
Merge pull request #113613 from arulajmani/backport23.2-113295
Browse files Browse the repository at this point in the history
  • Loading branch information
arulajmani authored Nov 3, 2023
2 parents 9662473 + 2b39b58 commit 1afc563
Show file tree
Hide file tree
Showing 127 changed files with 1,127 additions and 496 deletions.
2 changes: 1 addition & 1 deletion pkg/ccl/storageccl/engineccl/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func loadTestData(
timestamp := hlc.Timestamp{WallTime: minWallTime + rand.Int63n(int64(batchTimeSpan))}
value := roachpb.MakeValueFromBytes(randutil.RandBytes(rng, valueBytes))
value.InitChecksum(key)
if err := storage.MVCCPut(ctx, batch, key, timestamp, value, storage.MVCCWriteOptions{}); err != nil {
if _, err := storage.MVCCPut(ctx, batch, key, timestamp, value, storage.MVCCWriteOptions{}); err != nil {
tb.Fatal(err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/storageccl/engineccl/encrypted_fs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ func TestPebbleEncryption2(t *testing.T) {
require.True(t, validateKeys(db))

keys[key] = true
err = storage.MVCCPut(
_, err = storage.MVCCPut(
context.Background(),
db,
roachpb.Key(key),
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/abortspan/abortspan.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (sc *AbortSpan) Del(
ctx context.Context, reader storage.ReadWriter, ms *enginepb.MVCCStats, txnID uuid.UUID,
) error {
key := keys.AbortSpanKey(sc.rangeID, txnID)
_, err := storage.MVCCDelete(ctx, reader, key, hlc.Timestamp{}, storage.MVCCWriteOptions{Stats: ms})
_, _, err := storage.MVCCDelete(ctx, reader, key, hlc.Timestamp{}, storage.MVCCWriteOptions{Stats: ms})
return err
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/batch_spanset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ func TestSpanSetMVCCResolveWriteIntentRange(t *testing.T) {
defer eng.Close()
ctx := context.Background()
value := roachpb.MakeValueFromString("irrelevant")
if err := storage.MVCCPut(
if _, err := storage.MVCCPut(
ctx,
eng,
roachpb.Key("b"),
Expand Down
3 changes: 2 additions & 1 deletion pkg/kv/kvserver/batcheval/cmd_add_sstable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,8 @@ func TestEvalAddSSTable(t *testing.T) {
kv.Key.Timestamp.WallTime *= 1e9
v, err := storage.DecodeMVCCValue(kv.Value)
require.NoError(t, err)
require.NoError(t, storage.MVCCPut(ctx, b, kv.Key.Key, kv.Key.Timestamp, v.Value, storage.MVCCWriteOptions{Txn: txn}))
_, err = storage.MVCCPut(ctx, b, kv.Key.Key, kv.Key.Timestamp, v.Value, storage.MVCCWriteOptions{Txn: txn})
require.NoError(t, err)
case storage.MVCCRangeKeyValue:
v, err := storage.DecodeMVCCValue(kv.Value)
require.NoError(t, err)
Expand Down
5 changes: 3 additions & 2 deletions pkg/kv/kvserver/batcheval/cmd_clear_range_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ func TestCmdClearRange(t *testing.T) {
// Write some random point keys within the cleared span, above the range tombstones.
for i := 0; i < tc.keyCount; i++ {
key := roachpb.Key(fmt.Sprintf("%04d", i))
require.NoError(t, storage.MVCCPut(ctx, eng, key,
hlc.Timestamp{WallTime: int64(4+i%2) * 1e9}, value, storage.MVCCWriteOptions{}))
_, err := storage.MVCCPut(ctx, eng, key,
hlc.Timestamp{WallTime: int64(4+i%2) * 1e9}, value, storage.MVCCWriteOptions{})
require.NoError(t, err)
}

// Calculate the range stats.
Expand Down
4 changes: 2 additions & 2 deletions pkg/kv/kvserver/batcheval/cmd_conditional_put.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ func ConditionalPut(

var err error
if args.Blind {
err = storage.MVCCBlindConditionalPut(
_, err = storage.MVCCBlindConditionalPut(
ctx, readWriter, args.Key, ts, args.Value, args.ExpBytes, handleMissing, opts)
} else {
err = storage.MVCCConditionalPut(
_, err = storage.MVCCConditionalPut(
ctx, readWriter, args.Key, ts, args.Value, args.ExpBytes, handleMissing, opts)
}
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/batcheval/cmd_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func Delete(
}

var err error
reply.FoundKey, err = storage.MVCCDelete(
reply.FoundKey, _, err = storage.MVCCDelete(
ctx, readWriter, args.Key, h.Timestamp, opts,
)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/batcheval/cmd_delete_range.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func DeleteRange(
// written if we're evaluating the DeleteRange for a transaction so that we
// can update the Result's AcquiredLocks field.
returnKeys := args.ReturnKeys || h.Txn != nil
deleted, resumeSpan, num, err := storage.MVCCDeleteRange(
deleted, resumeSpan, num, _, err := storage.MVCCDeleteRange(
ctx, readWriter, args.Key, args.EndKey,
h.MaxSpanRequestKeys, timestamp,
opts, returnKeys)
Expand Down
14 changes: 9 additions & 5 deletions pkg/kv/kvserver/batcheval/cmd_delete_range_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,16 @@ func TestDeleteRangeTombstone(t *testing.T) {
var localTS hlc.ClockTimestamp

txn := roachpb.MakeTransaction("test", nil /* baseKey */, isolation.Serializable, roachpb.NormalUserPriority, hlc.Timestamp{WallTime: 5e9}, 0, 0, 0)
require.NoError(t, storage.MVCCPut(ctx, rw, roachpb.Key("b"), hlc.Timestamp{WallTime: 2e9}, roachpb.MakeValueFromString("b2"), storage.MVCCWriteOptions{}))
require.NoError(t, storage.MVCCPut(ctx, rw, roachpb.Key("c"), hlc.Timestamp{WallTime: 4e9}, roachpb.MakeValueFromString("c4"), storage.MVCCWriteOptions{}))
require.NoError(t, storage.MVCCPut(ctx, rw, roachpb.Key("d"), hlc.Timestamp{WallTime: 2e9}, roachpb.MakeValueFromString("d2"), storage.MVCCWriteOptions{}))
_, err := storage.MVCCDelete(ctx, rw, roachpb.Key("d"), hlc.Timestamp{WallTime: 3e9}, storage.MVCCWriteOptions{})
_, err := storage.MVCCPut(ctx, rw, roachpb.Key("b"), hlc.Timestamp{WallTime: 2e9}, roachpb.MakeValueFromString("b2"), storage.MVCCWriteOptions{})
require.NoError(t, err)
_, err = storage.MVCCPut(ctx, rw, roachpb.Key("c"), hlc.Timestamp{WallTime: 4e9}, roachpb.MakeValueFromString("c4"), storage.MVCCWriteOptions{})
require.NoError(t, err)
_, err = storage.MVCCPut(ctx, rw, roachpb.Key("d"), hlc.Timestamp{WallTime: 2e9}, roachpb.MakeValueFromString("d2"), storage.MVCCWriteOptions{})
require.NoError(t, err)
_, _, err = storage.MVCCDelete(ctx, rw, roachpb.Key("d"), hlc.Timestamp{WallTime: 3e9}, storage.MVCCWriteOptions{})
require.NoError(t, err)
_, err = storage.MVCCPut(ctx, rw, roachpb.Key("i"), hlc.Timestamp{WallTime: 5e9}, roachpb.MakeValueFromString("i5"), storage.MVCCWriteOptions{Txn: &txn})
require.NoError(t, err)
require.NoError(t, storage.MVCCPut(ctx, rw, roachpb.Key("i"), hlc.Timestamp{WallTime: 5e9}, roachpb.MakeValueFromString("i5"), storage.MVCCWriteOptions{Txn: &txn}))
require.NoError(t, storage.MVCCDeleteRangeUsingTombstone(ctx, rw, nil, roachpb.Key("f"), roachpb.Key("h"), hlc.Timestamp{WallTime: 3e9}, localTS, nil, nil, false, 0, nil))
require.NoError(t, storage.MVCCDeleteRangeUsingTombstone(ctx, rw, nil, roachpb.Key("Z"), roachpb.Key("a"), hlc.Timestamp{WallTime: 100e9}, localTS, nil, nil, false, 0, nil))
require.NoError(t, storage.MVCCDeleteRangeUsingTombstone(ctx, rw, nil, roachpb.Key("z"), roachpb.Key("|"), hlc.Timestamp{WallTime: 100e9}, localTS, nil, nil, false, 0, nil))
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/batcheval/cmd_end_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ func updateFinalizedTxn(
// BatchRequest writes.
return nil
}
_, err := storage.MVCCDelete(ctx, readWriter, key, hlc.Timestamp{}, opts)
_, _, err := storage.MVCCDelete(ctx, readWriter, key, hlc.Timestamp{}, opts)
return err
}
txn.LockSpans = externalLocks
Expand Down
6 changes: 3 additions & 3 deletions pkg/kv/kvserver/batcheval/cmd_end_transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1200,13 +1200,13 @@ func TestPartialRollbackOnEndTransaction(t *testing.T) {
// Write a first value at key.
v.SetString("a")
txn.Sequence = 1
if err := storage.MVCCPut(ctx, batch, k, ts, v, storage.MVCCWriteOptions{Txn: &txn}); err != nil {
if _, err := storage.MVCCPut(ctx, batch, k, ts, v, storage.MVCCWriteOptions{Txn: &txn}); err != nil {
t.Fatal(err)
}
// Write another value.
v.SetString("b")
txn.Sequence = 2
if err := storage.MVCCPut(ctx, batch, k, ts, v, storage.MVCCWriteOptions{Txn: &txn}); err != nil {
if _, err := storage.MVCCPut(ctx, batch, k, ts, v, storage.MVCCWriteOptions{Txn: &txn}); err != nil {
t.Fatal(err)
}

Expand Down Expand Up @@ -1648,7 +1648,7 @@ func TestResolveLocalLocks(t *testing.T) {
txn.Status = roachpb.COMMITTED

for i := 0; i < numKeys; i++ {
err := storage.MVCCPut(ctx, batch, intToKey(i), ts, roachpb.MakeValueFromString("a"), storage.MVCCWriteOptions{Txn: &txn})
_, err := storage.MVCCPut(ctx, batch, intToKey(i), ts, roachpb.MakeValueFromString("a"), storage.MVCCWriteOptions{Txn: &txn})
require.NoError(t, err)
}
resolvedLocks, releasedReplLocks, externalLocks, err := resolveLocalLocksWithPagination(
Expand Down
8 changes: 6 additions & 2 deletions pkg/kv/kvserver/batcheval/cmd_export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,9 @@ func TestRandomKeyAndTimestampExport(t *testing.T) {
valueSize := randutil.RandIntInRange(rnd, averageValueSize-100, averageValueSize+100)
value := roachpb.MakeValueFromBytes(randutil.RandBytes(rnd, valueSize))
value.InitChecksum(key)
if err := storage.MVCCPut(ctx, batch, key, ts, value, storage.MVCCWriteOptions{}); err != nil {
if _, err := storage.MVCCPut(
ctx, batch, key, ts, value, storage.MVCCWriteOptions{},
); err != nil {
t.Fatal(err)
}

Expand All @@ -836,7 +838,9 @@ func TestRandomKeyAndTimestampExport(t *testing.T) {
ts = hlc.Timestamp{WallTime: int64(curWallTime), Logical: int32(curLogical)}
value = roachpb.MakeValueFromBytes(randutil.RandBytes(rnd, 200))
value.InitChecksum(key)
if err := storage.MVCCPut(ctx, batch, key, ts, value, storage.MVCCWriteOptions{}); err != nil {
if _, err := storage.MVCCPut(
ctx, batch, key, ts, value, storage.MVCCWriteOptions{},
); err != nil {
t.Fatal(err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/batcheval/cmd_increment.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func Increment(
}

var err error
reply.NewValue, err = storage.MVCCIncrement(
reply.NewValue, _, err = storage.MVCCIncrement(
ctx, readWriter, args.Key, h.Timestamp, opts, args.Increment)
if err != nil {
return result.Result{}, err
Expand Down
4 changes: 2 additions & 2 deletions pkg/kv/kvserver/batcheval/cmd_init_put.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ func InitPut(

var err error
if args.Blind {
err = storage.MVCCBlindInitPut(
_, err = storage.MVCCBlindInitPut(
ctx, readWriter, args.Key, h.Timestamp, args.Value, args.FailOnTombstones, opts)
} else {
err = storage.MVCCInitPut(
_, err = storage.MVCCInitPut(
ctx, readWriter, args.Key, h.Timestamp, args.Value, args.FailOnTombstones, opts)
}
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/kv/kvserver/batcheval/cmd_put.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ func Put(

var err error
if args.Blind {
err = storage.MVCCBlindPut(ctx, readWriter, args.Key, ts, args.Value, opts)
_, err = storage.MVCCBlindPut(ctx, readWriter, args.Key, ts, args.Value, opts)
} else {
err = storage.MVCCPut(ctx, readWriter, args.Key, ts, args.Value, opts)
_, err = storage.MVCCPut(ctx, readWriter, args.Key, ts, args.Value, opts)
}
if err != nil {
return result.Result{}, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/batcheval/cmd_query_intent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestQueryIntent(t *testing.T) {

writeIntent := func(k roachpb.Key, ts int64) roachpb.Transaction {
txn := roachpb.MakeTransaction("test", k, 0, 0, makeTS(ts), 0, 1, 0)
_, err := storage.MVCCDelete(ctx, db, k, makeTS(ts), storage.MVCCWriteOptions{Txn: &txn})
_, _, err := storage.MVCCDelete(ctx, db, k, makeTS(ts), storage.MVCCWriteOptions{Txn: &txn})
require.NoError(t, err)
return txn
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ func TestQueryResolvedTimestamp(t *testing.T) {
return hlc.Timestamp{WallTime: ts}
}
writeValue := func(k string, ts int64) {
_, err := storage.MVCCDelete(ctx, db, roachpb.Key(k), makeTS(ts), storage.MVCCWriteOptions{})
_, _, err := storage.MVCCDelete(ctx, db, roachpb.Key(k), makeTS(ts), storage.MVCCWriteOptions{})
require.NoError(t, err)
}
writeIntent := func(k string, ts int64) {
txn := roachpb.MakeTransaction("test", roachpb.Key(k), 0, 0, makeTS(ts), 0, 1, 0)
_, err := storage.MVCCDelete(ctx, db, roachpb.Key(k), makeTS(ts), storage.MVCCWriteOptions{Txn: &txn})
_, _, err := storage.MVCCDelete(ctx, db, roachpb.Key(k), makeTS(ts), storage.MVCCWriteOptions{Txn: &txn})
require.NoError(t, err)
}
writeInline := func(k string) {
_, err := storage.MVCCDelete(ctx, db, roachpb.Key(k), hlc.Timestamp{}, storage.MVCCWriteOptions{})
_, _, err := storage.MVCCDelete(ctx, db, roachpb.Key(k), hlc.Timestamp{}, storage.MVCCWriteOptions{})
require.NoError(t, err)
}
writeLock := func(k string, str lock.Strength) {
Expand Down
4 changes: 3 additions & 1 deletion pkg/kv/kvserver/batcheval/cmd_refresh_range_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,9 @@ func setupData(
value := roachpb.MakeValueFromBytes(randutil.RandBytes(rng, opts.valueBytes))
value.InitChecksum(key)
ts := hlc.Timestamp{WallTime: int64((pos + 1) * 5)}
if err := storage.MVCCPut(ctx, batch, key, ts, value, storage.MVCCWriteOptions{}); err != nil {
if _, err := storage.MVCCPut(
ctx, batch, key, ts, value, storage.MVCCWriteOptions{},
); err != nil {
b.Fatal(err)
}
}
Expand Down
26 changes: 18 additions & 8 deletions pkg/kv/kvserver/batcheval/cmd_refresh_range_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ func TestRefreshRange(t *testing.T) {

// Write an MVCC point key at b@3, MVCC point tombstone at b@5, and MVCC range
// tombstone at [d-f)@7.
require.NoError(t, storage.MVCCPut(
ctx, eng, roachpb.Key("b"), hlc.Timestamp{WallTime: 3}, roachpb.MakeValueFromString("value"), storage.MVCCWriteOptions{}))
require.NoError(t, storage.MVCCPut(
ctx, eng, roachpb.Key("c"), hlc.Timestamp{WallTime: 5}, roachpb.Value{}, storage.MVCCWriteOptions{}))
_, err := storage.MVCCPut(
ctx, eng, roachpb.Key("b"), hlc.Timestamp{WallTime: 3}, roachpb.MakeValueFromString("value"), storage.MVCCWriteOptions{})
require.NoError(t, err)
_, err = storage.MVCCPut(
ctx, eng, roachpb.Key("c"), hlc.Timestamp{WallTime: 5}, roachpb.Value{}, storage.MVCCWriteOptions{})
require.NoError(t, err)
require.NoError(t, storage.MVCCDeleteRangeUsingTombstone(
ctx, eng, nil, roachpb.Key("d"), roachpb.Key("f"), hlc.Timestamp{WallTime: 7}, hlc.ClockTimestamp{}, nil, nil, false, 0, nil))

Expand Down Expand Up @@ -156,10 +158,14 @@ func TestRefreshRangeTimeBoundIterator(t *testing.T) {
},
ReadTimestamp: ts1,
}
if err := storage.MVCCPut(ctx, db, k, txn.ReadTimestamp, v, storage.MVCCWriteOptions{Txn: txn}); err != nil {
if _, err := storage.MVCCPut(
ctx, db, k, txn.ReadTimestamp, v, storage.MVCCWriteOptions{Txn: txn},
); err != nil {
t.Fatal(err)
}
if err := storage.MVCCPut(ctx, db, roachpb.Key("unused1"), ts4, v, storage.MVCCWriteOptions{}); err != nil {
if _, err := storage.MVCCPut(
ctx, db, roachpb.Key("unused1"), ts4, v, storage.MVCCWriteOptions{},
); err != nil {
t.Fatal(err)
}
if err := db.Flush(); err != nil {
Expand All @@ -180,7 +186,9 @@ func TestRefreshRangeTimeBoundIterator(t *testing.T) {
); err != nil {
t.Fatal(err)
}
if err := storage.MVCCPut(ctx, db, roachpb.Key("unused2"), ts1, v, storage.MVCCWriteOptions{}); err != nil {
if _, err := storage.MVCCPut(
ctx, db, roachpb.Key("unused2"), ts1, v, storage.MVCCWriteOptions{},
); err != nil {
t.Fatal(err)
}
if err := db.Flush(); err != nil {
Expand Down Expand Up @@ -273,7 +281,9 @@ func TestRefreshRangeError(t *testing.T) {
},
ReadTimestamp: ts2,
}
if err := storage.MVCCPut(ctx, db, k, txn.ReadTimestamp, v, storage.MVCCWriteOptions{Txn: txn}); err != nil {
if _, err := storage.MVCCPut(
ctx, db, k, txn.ReadTimestamp, v, storage.MVCCWriteOptions{Txn: txn},
); err != nil {
t.Fatal(err)
}

Expand Down
7 changes: 5 additions & 2 deletions pkg/kv/kvserver/batcheval/cmd_refresh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ func TestRefreshError(t *testing.T) {
},
ReadTimestamp: ts2,
}
if err := storage.MVCCPut(ctx, db, k, txn.ReadTimestamp, v, storage.MVCCWriteOptions{Txn: txn}); err != nil {
if _, err := storage.MVCCPut(
ctx, db, k, txn.ReadTimestamp, v, storage.MVCCWriteOptions{Txn: txn},
); err != nil {
t.Fatal(err)
}

Expand Down Expand Up @@ -139,7 +141,8 @@ func TestRefreshTimestampBounds(t *testing.T) {
ts3 := hlc.Timestamp{WallTime: 3}

// Write to a key at time ts2.
require.NoError(t, storage.MVCCPut(ctx, db, k, ts2, v, storage.MVCCWriteOptions{}))
_, err := storage.MVCCPut(ctx, db, k, ts2, v, storage.MVCCWriteOptions{})
require.NoError(t, err)

for _, tc := range []struct {
from, to hlc.Timestamp
Expand Down
6 changes: 3 additions & 3 deletions pkg/kv/kvserver/batcheval/cmd_resolve_intent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ func TestResolveIntentAfterPartialRollback(t *testing.T) {
// Write a first value at key.
v.SetString("a")
txn.Sequence = 0
if err := storage.MVCCPut(ctx, batch, k, ts, v, storage.MVCCWriteOptions{Txn: &txn}); err != nil {
if _, err := storage.MVCCPut(ctx, batch, k, ts, v, storage.MVCCWriteOptions{Txn: &txn}); err != nil {
t.Fatal(err)
}
// Write another value.
v.SetString("b")
txn.Sequence = 1
if err := storage.MVCCPut(ctx, batch, k, ts, v, storage.MVCCWriteOptions{Txn: &txn}); err != nil {
if _, err := storage.MVCCPut(ctx, batch, k, ts, v, storage.MVCCWriteOptions{Txn: &txn}); err != nil {
t.Fatal(err)
}
if err := batch.Commit(true); err != nil {
Expand Down Expand Up @@ -307,7 +307,7 @@ func TestResolveIntentWithTargetBytes(t *testing.T) {
st := cluster.MakeTestingClusterSettings()

for i, testKey := range testKeys {
err := storage.MVCCPut(ctx, batch, testKey, ts, values[i], storage.MVCCWriteOptions{Txn: &txn})
_, err := storage.MVCCPut(ctx, batch, testKey, ts, values[i], storage.MVCCWriteOptions{Txn: &txn})
require.NoError(t, err)
}
initialBytes := batch.Len()
Expand Down
18 changes: 13 additions & 5 deletions pkg/kv/kvserver/batcheval/cmd_revert_range_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ func TestCmdRevertRange(t *testing.T) {
key := roachpb.Key(fmt.Sprintf("%04d", i))
var value roachpb.Value
value.SetString(fmt.Sprintf("%d", i))
if err := storage.MVCCPut(ctx, eng, key, baseTime.Add(int64(i%10), 0), value, storage.MVCCWriteOptions{Stats: &stats}); err != nil {
if _, err := storage.MVCCPut(
ctx, eng, key, baseTime.Add(int64(i%10), 0), value, storage.MVCCWriteOptions{Stats: &stats},
); err != nil {
t.Fatal(err)
}
}
Expand All @@ -83,7 +85,9 @@ func TestCmdRevertRange(t *testing.T) {
key := roachpb.Key(fmt.Sprintf("%04d", i))
var value roachpb.Value
value.SetString(fmt.Sprintf("%d-rev-a", i))
if err := storage.MVCCPut(ctx, eng, key, tsA.Add(int64(i%5), 1), value, storage.MVCCWriteOptions{Stats: &stats}); err != nil {
if _, err := storage.MVCCPut(
ctx, eng, key, tsA.Add(int64(i%5), 1), value, storage.MVCCWriteOptions{Stats: &stats},
); err != nil {
t.Fatal(err)
}
}
Expand All @@ -96,7 +100,9 @@ func TestCmdRevertRange(t *testing.T) {
key := roachpb.Key(fmt.Sprintf("%04d", i))
var value roachpb.Value
value.SetString(fmt.Sprintf("%d-rev-b", i))
if err := storage.MVCCPut(ctx, eng, key, tsB.Add(1, int32(i%5)), value, storage.MVCCWriteOptions{Stats: &stats}); err != nil {
if _, err := storage.MVCCPut(
ctx, eng, key, tsB.Add(1, int32(i%5)), value, storage.MVCCWriteOptions{Stats: &stats},
); err != nil {
t.Fatal(err)
}
}
Expand Down Expand Up @@ -173,7 +179,7 @@ func TestCmdRevertRange(t *testing.T) {
}

txn := roachpb.MakeTransaction("test", nil, isolation.Serializable, roachpb.NormalUserPriority, tsC, 1, 1, 0)
if err := storage.MVCCPut(
if _, err := storage.MVCCPut(
ctx, eng, []byte("0012"), tsC, roachpb.MakeValueFromBytes([]byte("i")), storage.MVCCWriteOptions{Txn: &txn, Stats: &stats},
); err != nil {
t.Fatal(err)
Expand All @@ -185,7 +191,9 @@ func TestCmdRevertRange(t *testing.T) {
key := roachpb.Key(fmt.Sprintf("%04d", i))
var value roachpb.Value
value.SetString(fmt.Sprintf("%d-rev-b", i))
if err := storage.MVCCPut(ctx, eng, key, tsC.Add(10, int32(i%5)), value, storage.MVCCWriteOptions{Stats: &stats}); err != nil {
if _, err := storage.MVCCPut(
ctx, eng, key, tsC.Add(10, int32(i%5)), value, storage.MVCCWriteOptions{Stats: &stats},
); err != nil {
t.Fatalf("writing key %s: %+v", key, err)
}
}
Expand Down
Loading

0 comments on commit 1afc563

Please sign in to comment.