Revert "add key dedupe when a write buffer writeback to an empty read buffer bucket."

This reverts commit 971a4f57ccff71dfc10c1f9eb7a6a4d64bec1d2e.

Signed-off-by: Siyuan Zhang <sizhang@google.com>
This commit is contained in:
Siyuan Zhang 2024-01-19 08:57:50 -08:00
parent e5665a7ef2
commit 93afd8e430

View File

@ -83,7 +83,6 @@ func (txw *txWriteBuffer) writeback(txr *txReadBuffer) {
if !ok {
delete(txw.buckets, k)
txr.buckets[k] = wb
wb.dedupe()
continue
}
if seq, ok := txw.bucket2seq[k]; ok && !seq && wb.used > 1 {
@ -204,12 +203,10 @@ func (bb *bucketBuffer) merge(bbsrc *bucketBuffer) {
if bytes.Compare(bb.buf[(bb.used-bbsrc.used)-1].key, bbsrc.buf[0].key) < 0 {
return
}
bb.dedupe()
}
// dedupe removes duplicates, using only newest update
func (bb *bucketBuffer) dedupe() {
sort.Stable(bb)
// remove duplicates, using only newest update
widx := 0
for ridx := 1; ridx < bb.used; ridx++ {
if !bytes.Equal(bb.buf[ridx].key, bb.buf[widx].key) {