Skip to content
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

minimal snapshot #2904

Open
wants to merge 64 commits into
base: master
Choose a base branch
from
Open

minimal snapshot #2904

wants to merge 64 commits into from

Conversation

magicxyyz
Copy link
Contributor

@magicxyyz magicxyyz commented Jan 28, 2025

Resolves NIT-3057

This PR adds database snapshotter that allows exporting a minimal execution database (here called snapshot) that consists of:

  • chain config entry
  • genesis state
  • head state
  • blocks and receipts up to the head block

In connection with manual copying of consensus database (arbitrumdata) this can be used to create a complete databases snapshot for a full node.

The snapshotter can be enabled with flag: --execution.database-snaphotter.enable (disabled by default).
Currently there are two ways to trigger the snapshot export:

  • sending SIGUSR2 to nitro process - starts the export with snapshot head set to latest block which state is found in disk database (e.g. docker kill -s "SIGUSR2" nitro-node)
  • calling snapshotter_snapshot rpc method that takes block number or block tag parameter - starts the export with snapshot head set to latest block that is not newer then specified block and has state available in disk database; snapshotter_result might be called to check the export status (the method takes "rewind" boolean parameter if set true and previous snapshotter run finished it discards cached result and new snapshot can be started)

Initial version supports exporting only to geth format database. The output database is specified by following options:

  • --execution.database-snapshotter.geth-exporter.output.data
    directory of stored chain state (default "snapshot")
  • --execution.database-snapshotter.geth-exporter.output.ancient
    directory of ancient where the chain freezer can be opened (default "ancient")
  • --execution.database-snapshotter.geth-exporter.output.cache
    the capacity(in megabytes) of the data caching (default 2048)
  • --execution.database-snapshotter.geth-exporter.output.db-engine
    backing database implementation to use ('leveldb' or 'pebble')
  • --execution.database-snapshotter.geth-exporter.output.handles
    number of files to be open simultaneously (default 512)
  • --execution.database-snapshotter.geth-exporter.output.namespace
    metrics namespace (default "l2chaindata_export")
  • --execution.database-snapshotter.geth-exporter.output.pebble.*
    extra options for pebble engine, see --help for details
  • --execution.database-snapshotter.geth-exporter.ideal-batch-size
    ideal write batch size in bytes (default 104857600)

Number of threads used by the snapshotter is specified by --execution.database-snapshoter.threads option.

Pulls: OffchainLabs/go-ethereum#402

@magicxyyz magicxyyz changed the title Minimal snapshot minimal snapshot Jan 28, 2025
@magicxyyz magicxyyz marked this pull request as ready for review February 18, 2025 15:45
@magicxyyz magicxyyz requested review from eljobe, tsahee and ganeshvanahalli and removed request for eljobe and tsahee February 18, 2025 15:45
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.

1 participant