Skip to content

Commit 54e5ba6

Browse files
committed
db: use testkeys comparer in TestTracing
We need a comparer that supports suffixes to extend the test with range keys. Note that the testkeys comparer has a worse `Separator` implementation when there are no suffixes, leading to the slightly larger index block.
1 parent 0e23292 commit 54e5ba6

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

db_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/cockroachdb/fifo"
2626
"github.com/cockroachdb/pebble/internal/base"
2727
"github.com/cockroachdb/pebble/internal/cache"
28+
"github.com/cockroachdb/pebble/internal/testkeys"
2829
"github.com/cockroachdb/pebble/internal/testutils"
2930
"github.com/cockroachdb/pebble/objstorage/objstorageprovider"
3031
"github.com/cockroachdb/pebble/sstable"
@@ -1447,6 +1448,7 @@ func TestTracing(t *testing.T) {
14471448
}
14481449
db = testutils.CheckErr(Open("", &Options{
14491450
FS: vfs.NewMem(),
1451+
Comparer: testkeys.Comparer,
14501452
Cache: cache,
14511453
LoggerAndTracer: &tracer,
14521454
}))

testdata/tracing

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ hello
77
----
88
reading footer of 53 bytes took 5ms
99
reading block of 37 bytes took 5ms (<redacted>)
10-
reading block of 419 bytes took 5ms (<redacted>)
11-
reading block of 27 bytes took 5ms (<redacted>)
10+
reading block of 417 bytes took 5ms (<redacted>)
11+
reading block of 31 bytes took 5ms (<redacted>)
1212
reading block of 32 bytes took 5ms (<redacted>)
1313
hello:foo
1414

@@ -21,20 +21,20 @@ hello:foo
2121
iter
2222
seek-ge hello
2323
----
24-
reading block of 27 bytes took 5ms (<redacted>)
24+
reading block of 31 bytes took 5ms (<redacted>)
2525
reading block of 32 bytes took 5ms (<redacted>)
2626
hello: (foo, .)
2727

2828
snapshot-iter
2929
seek-ge hello
3030
----
31-
reading block of 27 bytes took 5ms (<redacted>)
31+
reading block of 31 bytes took 5ms (<redacted>)
3232
reading block of 32 bytes took 5ms (<redacted>)
3333
hello: (foo, .)
3434

3535
indexed-batch-iter
3636
seek-ge hello
3737
----
38-
reading block of 27 bytes took 5ms (<redacted>)
38+
reading block of 31 bytes took 5ms (<redacted>)
3939
reading block of 32 bytes took 5ms (<redacted>)
4040
hello: (foo, .)

0 commit comments

Comments
 (0)