Erigon Segment Step Rebase
Overview
The erigon seg step-rebase command changes the step size of an existing Erigon datadir. This is used to modify the granularity of snapshot segments.
Command Syntax
bash
./build/bin/erigon seg step-rebase --datadir=<path> --new-step-size=<size> [other-flags]
Required Flags
- •
--datadir: Path to the Erigon datadir (required) - •
--new-step-size: New step size to rebase to (default: 1562500)
Common Step Sizes
- •
1562500: Default/full stepsize - •
781250: stepsize/2 (half step) - •
390625: stepsize/4 (quarter step)
Usage Patterns
Rebase to Half Step
bash
./build/bin/erigon seg step-rebase --datadir=/path/to/datadir --new-step-size=781250
Rebase to Quarter Step
bash
./build/bin/erigon seg step-rebase --datadir=/path/to/datadir --new-step-size=390625
Important Considerations
Before Running
- •Backup datadir: Consider backing up the datadir before rebasing
- •Stop Erigon: Ensure Erigon is not running on the target datadir
- •Verify current step: Check what the current step size is
- •Ensure Erigon binary is built: run
make erigonto build it
After Running
- •Verify the rebase completed successfully
- •Check segment files in the datadir
- •Restart Erigon if needed
Step Sizes
Common step sizes used in Erigon:
- •
1562500: Full/default stepsize - •
781250: Half step (stepsize/2) - •
390625: Quarter step (stepsize/4)
The step size affects:
- •Snapshot segment granularity
- •File size and organization
- •Query and sync performance
Workflow
When the user wants to rebase step size:
- •
Confirm parameters
- •Ask for target datadir path
- •Ask for desired step size
- •Confirm if they want to rebase a specific range
- •
Safety checks
- •Verify datadir exists
- •Check if Erigon is running (should not be)
- •
Execute rebase
bash./build/bin/erigon seg step-rebase --datadir=/path/to/datadir --new-step-size=<size>
- •
Verify results
- •Check command output for errors
- •List segment files to verify changes
Error Handling
Common issues:
- •"datadir not found": Verify the path is correct
- •"database locked": Stop Erigon process first
- •Invalid step size: Use valid step sizes (1562500, 781250, or 390625)
Examples
Example 1: Rebase datadir to half step
bash
./build/bin/erigon seg step-rebase --datadir=./chaindata --new-step-size=781250
Example 2: Rebase to quarter step
bash
./build/bin/erigon seg step-rebase --datadir=/mnt/erigon/datadir --new-step-size=390625
Tips
- •The operation can be time-consuming for large datadirs
- •Smaller step sizes (like 390625) create more granular segments
- •If building from source, use
make erigonto build the binary atbuild/bin/erigon