From f4ac548619e12e5be31543a72e995ab2b3904214 Mon Sep 17 00:00:00 2001 From: rjl493456442 Date: Wed, 1 Nov 2023 00:19:31 +0800 Subject: [PATCH] ethdb/pebble: cap memory table size as maxMemTableSize-1 (#28444) --- ethdb/pebble/pebble.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ethdb/pebble/pebble.go b/ethdb/pebble/pebble.go index 691aa7329..d713e2863 100644 --- a/ethdb/pebble/pebble.go +++ b/ethdb/pebble/pebble.go @@ -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,