From a25a2143cecb0fe6554daa4648fbeafc43a79873 Mon Sep 17 00:00:00 2001 From: wayen <2229306838@qq.com> Date: Wed, 3 Jan 2024 14:37:01 +0800 Subject: [PATCH] ethdb/pebble: cap memory table size as maxMemTableSize-1 (#28444) (#2120) --- 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 561524c0a4c0..429e92004ee6 100644 --- a/ethdb/pebble/pebble.go +++ b/ethdb/pebble/pebble.go @@ -156,8 +156,15 @@ func New(file string, cache int, handles int, namespace string, readonly bool) ( // 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 } logger.Info("Allocated cache and file handles", "cache", common.StorageSize(cache*1024*1024),