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

lightning: remove the unnecessary offset field in the key encoding for duplicate detection #29975

Merged
merged 9 commits into from
Dec 28, 2021
Prev Previous commit
Next Next commit
remove t.Parallel() in test
  • Loading branch information
sleepymole committed Dec 24, 2021
commit 3fb2f2ea1b89b9b5be8da62285675479b951b90e
4 changes: 0 additions & 4 deletions br/pkg/lightning/backend/local/iterator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ import (
)

func TestDupDetectIterator(t *testing.T) {
t.Parallel()

var pairs []common.KvPair
prevRowMax := int64(0)
// Unique pairs.
Expand Down Expand Up @@ -183,8 +181,6 @@ func TestDupDetectIterator(t *testing.T) {
}

func TestDupDetectIterSeek(t *testing.T) {
t.Parallel()

pairs := []common.KvPair{
{
Key: []byte{1, 2, 3, 0},
Expand Down
14 changes: 0 additions & 14 deletions br/pkg/lightning/backend/local/key_adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ func randBytes(n int) []byte {
}

func TestNoopKeyAdapter(t *testing.T) {
t.Parallel()

keyAdapter := noopKeyAdapter{}
key := randBytes(32)
require.Equal(t, len(key), keyAdapter.EncodedLen(key))
Expand All @@ -46,8 +44,6 @@ func TestNoopKeyAdapter(t *testing.T) {
}

func TestDupDetectKeyAdapter(t *testing.T) {
t.Parallel()

inputs := []struct {
key []byte
rowID int64
Expand Down Expand Up @@ -83,8 +79,6 @@ func TestDupDetectKeyAdapter(t *testing.T) {
}

func TestDupDetectKeyOrder(t *testing.T) {
t.Parallel()

keys := [][]byte{
{0x0, 0x1, 0x2},
{0x0, 0x1, 0x3},
Expand All @@ -104,8 +98,6 @@ func TestDupDetectKeyOrder(t *testing.T) {
}

func TestDupDetectEncodeDupKey(t *testing.T) {
t.Parallel()

keyAdapter := dupDetectKeyAdapter{}
key := randBytes(32)
result1 := keyAdapter.Encode(nil, key, 10)
Expand All @@ -118,8 +110,6 @@ func startWithSameMemory(x []byte, y []byte) bool {
}

func TestEncodeKeyToPreAllocatedBuf(t *testing.T) {
t.Parallel()

keyAdapters := []KeyAdapter{noopKeyAdapter{}, dupDetectKeyAdapter{}}
for _, keyAdapter := range keyAdapters {
key := randBytes(32)
Expand All @@ -134,8 +124,6 @@ func TestEncodeKeyToPreAllocatedBuf(t *testing.T) {
}

func TestDecodeKeyToPreAllocatedBuf(t *testing.T) {
t.Parallel()

data := []byte{
0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf7,
0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf,
Expand All @@ -153,8 +141,6 @@ func TestDecodeKeyToPreAllocatedBuf(t *testing.T) {
}

func TestDecodeKeyDstIsInsufficient(t *testing.T) {
t.Parallel()

data := []byte{
0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf7,
0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf,
Expand Down