ethdb/pebble: cap memory table size as maxMemTableSize-1 (#28444)

This commit is contained in:
rjl493456442 2023-11-01 00:19:31 +08:00 committed by GitHub
parent 285202aae2
commit f4ac548619
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -160,8 +160,15 @@ func New(file string, cache int, handles int, namespace string, readonly bool, e
// including a frozen memory table and another live one.
memTableLimit := 2
memTableSize := cache * 1024 * 1024 / 2 / memTableLimit
if memTableSize > maxMemTableSize {
memTableSize = maxMemTableSize
// The memory table size is currently capped at maxMemTableSize-1 due to a
// known bug in the pebble where maxMemTableSize is not recognized as a
// valid size.
//
// TODO use the maxMemTableSize as the maximum table size once the issue
// in pebble is fixed.
if memTableSize >= maxMemTableSize {
memTableSize = maxMemTableSize - 1
}
db := &Database{
fn: file,