Skip to content

core, ethdb: introduce database sync function #31703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 8, 2025

Conversation

rjl493456442
Copy link
Member

@rjl493456442 rjl493456442 commented Apr 24, 2025

This pull request introduces a SyncKeyValue function to the ethdb.KeyValueStore
interface, providing the ability to forcibly flush all previous writes to disk.

This functionality is critical for go-ethereum, which internally uses two independent
database engines: a key-value store (such as Pebble, LevelDB, or memoryDB for
testing) and a flat-file–based freezer. To ensure write-order consistency between
these engines, the key-value store must be explicitly synced before writing to the
freezer and vice versa.

Fixes

@rjl493456442 rjl493456442 requested a review from fjl as a code owner April 24, 2025 13:21
@Eduardo40796
Copy link

Nenhuma descrição fornecida.

Oi

@fjl fjl changed the title WIP: introduce database sync function core, ethdb: introduce database sync function Apr 29, 2025
@rjl493456442 rjl493456442 added this to the 1.15.11 milestone Apr 30, 2025
@fjl fjl modified the milestones: 1.15.11, 1.15.12 May 5, 2025
Copy link
Member

@MariusVanDerWijden MariusVanDerWijden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -144,7 +144,7 @@ func (l panicLogger) Fatalf(format string, args ...interface{}) {

// New returns a wrapped pebble DB object. The namespace is the prefix that the
// metrics reporting should use for surfacing internal stats.
func New(file string, cache int, handles int, namespace string, readonly bool, ephemeral bool) (*Database, error) {
func New(file string, cache int, handles int, namespace string, readonly bool) (*Database, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we introduce a pebble.Config struct here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure. It's a bit complicated for external users to configure the Pebble by themselves?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway, it can be done in the following PR!

@rjl493456442 rjl493456442 merged commit 1051976 into ethereum:master May 8, 2025
3 of 4 checks passed
Dargon789 pushed a commit to Dargon789/go-ethereum that referenced this pull request May 27, 2025
This pull request introduces a SyncKeyValue function to the
ethdb.KeyValueStore
interface, providing the ability to forcibly flush all previous writes
to disk.

This functionality is critical for go-ethereum, which internally uses
two independent
database engines: a key-value store (such as Pebble, LevelDB, or
memoryDB for
testing) and a flat-file–based freezer. To ensure write-order
consistency between
these engines, the key-value store must be explicitly synced before
writing to the
freezer and vice versa.

Fixes 
- ethereum#31405
- ethereum#29819
sduchesneau pushed a commit to streamingfast/go-ethereum that referenced this pull request Jun 6, 2025
This pull request introduces a SyncKeyValue function to the
ethdb.KeyValueStore
interface, providing the ability to forcibly flush all previous writes
to disk.

This functionality is critical for go-ethereum, which internally uses
two independent
database engines: a key-value store (such as Pebble, LevelDB, or
memoryDB for
testing) and a flat-file–based freezer. To ensure write-order
consistency between
these engines, the key-value store must be explicitly synced before
writing to the
freezer and vice versa.

Fixes
- ethereum#31405
- ethereum#29819
sduchesneau pushed a commit to streamingfast/go-ethereum that referenced this pull request Jun 6, 2025
core, ethdb: introduce database sync function (ethereum#31703)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants