diff --git a/index/store/moss/batch.go b/index/store/moss/batch.go index 1263b8b0..f72334c8 100644 --- a/index/store/moss/batch.go +++ b/index/store/moss/batch.go @@ -54,6 +54,9 @@ func (b *Batch) Delete(key []byte) { } func (b *Batch) Merge(key, val []byte) { + if b.buf != nil { + b.bufUsed += len(key) + len(val) + } b.merge.Merge(key, val) } diff --git a/index/upside_down/upside_down.go b/index/upside_down/upside_down.go index 00db38c3..08dc649d 100644 --- a/index/upside_down/upside_down.go +++ b/index/upside_down/upside_down.go @@ -219,7 +219,7 @@ func (udc *UpsideDownCouch) batchRows(writer store.KVWriter, addRowsAll [][]Upsi totBytes := addKeyBytes + addValBytes + updateKeyBytes + updateValBytes + deleteKeyBytes + - mergeKeyBytes + mergeValBytes + 2*(mergeKeyBytes+mergeValBytes) buf, wb, err := writer.NewBatchEx(store.KVBatchOptions{ TotalBytes: totBytes,