Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(benchmarks): use uint32 in filename generation #1741

Merged
merged 1 commit into from
Sep 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func buildTable(t *testing.T, keyValues [][]string, bopts table.Options) *table.
defer b.Close()
// TODO: Add test for file garbage collection here. No files should be left after the tests here.

filename := fmt.Sprintf("%s%s%d.sst", os.TempDir(), string(os.PathSeparator), rand.Int63())
filename := fmt.Sprintf("%s%s%d.sst", os.TempDir(), string(os.PathSeparator), rand.Uint32())

sort.Slice(keyValues, func(i, j int) bool {
return keyValues[i][0] < keyValues[j][0]
Expand Down
6 changes: 3 additions & 3 deletions table/table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ func TestTableBigValues(t *testing.T) {
builder.Add(key, vs, 0)
}

filename := fmt.Sprintf("%s%s%d.sst", os.TempDir(), string(os.PathSeparator), rand.Int63())
filename := fmt.Sprintf("%s%s%d.sst", os.TempDir(), string(os.PathSeparator), rand.Uint32())
tbl, err := CreateTable(filename, builder)
require.NoError(t, err, "unable to open table")
defer tbl.DecrRef()
Expand Down Expand Up @@ -754,7 +754,7 @@ func BenchmarkReadMerged(b *testing.B) {
require.NoError(b, err)

for i := 0; i < m; i++ {
filename := fmt.Sprintf("%s%s%d.sst", os.TempDir(), string(os.PathSeparator), rand.Int63())
filename := fmt.Sprintf("%s%s%d.sst", os.TempDir(), string(os.PathSeparator), rand.Uint32())
opts := Options{Compression: options.ZSTD, BlockSize: 4 * 1024, BloomFalsePositive: 0.01}
opts.BlockCache = cache
builder := NewTableBuilder(opts)
Expand Down Expand Up @@ -848,7 +848,7 @@ func getTableForBenchmarks(b *testing.B, count int, cache *ristretto.Cache) *Tab
opts.BlockCache = cache
builder := NewTableBuilder(opts)
defer builder.Close()
filename := fmt.Sprintf("%s%s%d.sst", os.TempDir(), string(os.PathSeparator), rand.Int63())
filename := fmt.Sprintf("%s%s%d.sst", os.TempDir(), string(os.PathSeparator), rand.Uint32())
for i := 0; i < count; i++ {
k := fmt.Sprintf("%016x", i)
v := fmt.Sprintf("%d", i)
Expand Down
5 changes: 3 additions & 2 deletions value_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -965,8 +965,9 @@ func BenchmarkReadWrite(b *testing.B) {
dir, err := ioutil.TempDir("", "vlog-benchmark")
y.Check(err)
defer removeDir(dir)

db, err := Open(getTestOptions(dir))
opts := getTestOptions(dir)
opts.ValueThreshold = 0
db, err := Open(opts)
y.Check(err)

vl := &db.vlog
Expand Down