From 162a93751aafb99c27037e5aabd8e329d29a9805 Mon Sep 17 00:00:00 2001 From: Maciej Kulawik Date: Tue, 19 Nov 2024 17:54:54 +0100 Subject: [PATCH 1/2] add SyncMode option to PebbleExtraOptions --- ethdb/pebble/extraoptions.go | 1 + ethdb/pebble/pebble.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ethdb/pebble/extraoptions.go b/ethdb/pebble/extraoptions.go index 787167c1cc..811be7e0c0 100644 --- a/ethdb/pebble/extraoptions.go +++ b/ethdb/pebble/extraoptions.go @@ -3,6 +3,7 @@ package pebble import "time" type ExtraOptions struct { + SyncMode bool BytesPerSync int L0CompactionFileThreshold int L0CompactionThreshold int diff --git a/ethdb/pebble/pebble.go b/ethdb/pebble/pebble.go index 069c6e59bf..3f6bbdbd8a 100644 --- a/ethdb/pebble/pebble.go +++ b/ethdb/pebble/pebble.go @@ -234,11 +234,12 @@ func New(file string, cache int, handles int, namespace string, readonly bool, e if memTableSize >= maxMemTableSize { memTableSize = maxMemTableSize - 1 } + db := &Database{ fn: file, log: logger, quitChan: make(chan chan error), - writeOptions: &pebble.WriteOptions{Sync: !ephemeral}, + writeOptions: &pebble.WriteOptions{Sync: !ephemeral && extraOptions.SyncMode}, } opt := &pebble.Options{ // Pebble has a single combined cache area and the write From 50bb1f81101d321301e1d372422bef2950dd314f Mon Sep 17 00:00:00 2001 From: Maciej Kulawik Date: Tue, 19 Nov 2024 18:16:20 +0100 Subject: [PATCH 2/2] remove extra newline --- ethdb/pebble/pebble.go | 1 - 1 file changed, 1 deletion(-) diff --git a/ethdb/pebble/pebble.go b/ethdb/pebble/pebble.go index 3f6bbdbd8a..fbdfbcd9d1 100644 --- a/ethdb/pebble/pebble.go +++ b/ethdb/pebble/pebble.go @@ -234,7 +234,6 @@ func New(file string, cache int, handles int, namespace string, readonly bool, e if memTableSize >= maxMemTableSize { memTableSize = maxMemTableSize - 1 } - db := &Database{ fn: file, log: logger,