Skip to content

Commit

Permalink
kv: remove expensive print
Browse files Browse the repository at this point in the history
Removes an unnecessarily expensive assertion from the bench test as it
was taking >50% of the runtime. Now the test correctly spends time on
the important code.

Informs: cockroachdb#98881

Epic: none
Release note: None
  • Loading branch information
andrewbaptist committed Mar 29, 2023
1 parent d1f5bf3 commit e5e47ab
Showing 1 changed file with 3 additions and 1 deletion.
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 @@ -125,6 +125,8 @@ func runRefreshRangeBenchmark(b *testing.B, emk engineMaker, opts benchOptions)
startKey := roachpb.Key(encoding.EncodeUvarintAscending([]byte("key-"), uint64(0)))
endKey := roachpb.Key(encoding.EncodeUvarintAscending([]byte("key-"), uint64(opts.dataOpts.numKeys)))

var refreshErr *kvpb.RefreshFailedError

b.ResetTimer()
for i := 0; i < b.N; i++ {
func() {
Expand Down Expand Up @@ -157,7 +159,7 @@ func runRefreshRangeBenchmark(b *testing.B, emk engineMaker, opts benchOptions)
require.NoError(b, err)
} else {
require.Error(b, err)
require.Regexp(b, "encountered recently written committed value", err)
require.ErrorAs(b, err, &refreshErr)
}
}()
}
Expand Down

0 comments on commit e5e47ab

Please sign in to comment.