Unverified Commit 53f81574 authored by rjl493456442's avatar rjl493456442 Committed by GitHub

ethdb: more accurate batch size calculation (#23790)

This PR also counts the size of the key when calculating the size of a db batch
parent c72b16c3
......@@ -455,7 +455,7 @@ type batch struct {
// Put inserts the given value into the batch for later committing.
func (b *batch) Put(key, value []byte) error {
b.b.Put(key, value)
b.size += len(value)
b.size += len(key) + len(value)
return nil
}
......
......@@ -204,7 +204,7 @@ type batch struct {
// Put inserts the given value into the batch for later committing.
func (b *batch) Put(key, value []byte) error {
b.writes = append(b.writes, keyvalue{common.CopyBytes(key), common.CopyBytes(value), false})
b.size += len(value)
b.size += len(key) + len(value)
return nil
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment