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
tiny fix
  • Loading branch information
sleepymole committed Nov 25, 2021
commit 8928683f6f22e7d30c0d4316c0954c05378e6f81
4 changes: 1 addition & 3 deletions br/pkg/lightning/backend/local/iterator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,7 @@ func TestDupDetectIterSeek(t *testing.T) {
},
}

storeDir, err := os.MkdirTemp("", "lightning-test")
require.NoError(t, err)
defer os.RemoveAll(storeDir)
storeDir := t.TempDir()
db, err := pebble.Open(filepath.Join(storeDir, "kv"), &pebble.Options{})
require.NoError(t, err)

Expand Down
2 changes: 1 addition & 1 deletion br/pkg/lightning/backend/local/key_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (dupDetectKeyAdapter) Encode(dst []byte, key []byte, rowID int64) []byte {
dst = reallocBytes(dst, 8)
n := len(dst)
dst = dst[:n+8]
binary.BigEndian.PutUint64(dst[n:n+8], uint64(rowID))
binary.BigEndian.PutUint64(dst[n:n+8], codec.EncodeIntToCmpUint(rowID))
return dst
}

Expand Down