Snapshots: remove "experimental" prefix from cli flag (#3760)

This commit is contained in:
Alex Sharov 2022-03-24 12:17:31 +07:00 committed by GitHub
parent a357421719
commit 85e47d83d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 33 additions and 27 deletions

View File

@ -81,7 +81,7 @@ func (cli *Protocols) PeerID() []byte {
}
func LoggingLoop(ctx context.Context, torrentClient *torrent.Client) {
interval := time.Second * 5
interval := time.Second * 20
logEvery := time.NewTicker(interval)
defer logEvery.Stop()
var m runtime.MemStats

View File

@ -4,15 +4,13 @@ Service to seed/download historical data (immutable .seg files)
## How to Start Erigon in snapshot sync mode
Only Mainnet, Goerli and BSC networks are supported now.
```shell
# 1. Downloader by default run inside Erigon, by `--experimental.snapshot` flag:
erigon --experimental.snapshot --datadir=<your_datadir>
# 1. Downloader by default run inside Erigon, by `--snapshot` flag:
erigon --snapshot --datadir=<your_datadir>
```
```shell
# 2. It's possible to start Downloader as independent process, by `--experimental.snapshot --downloader.api.addr=127.0.0.1:9093` flags:
# 2. It's possible to start Downloader as independent process, by `--snapshot --downloader.api.addr=127.0.0.1:9093` flags:
make erigon downloader
# Start downloader (can limit network usage by 512mb/sec: --download.rate=512mb --upload.rate=512mb)
@ -21,10 +19,18 @@ downloader --downloader.api.addr=127.0.0.1:9093 --torrent.port=42068 --datadir=<
# --torrent.port=42068 - is for public BitTorrent protocol listen
# Erigon on startup does send list of .torrent files to Downloader and wait for 100% download accomplishment
erigon --experimental.snapshot --downloader.api.addr=127.0.0.1:9093 --datadir=<your_datadir>
erigon --snapshot --downloader.api.addr=127.0.0.1:9093 --datadir=<your_datadir>
```
Use `--experimental.snapshot.keepblocks=true` to don't delete retired blocks from DB
Use `--snapshot.keepblocks=true` to don't delete retired blocks from DB
Any network/chain can start with snapshot sync:
- node will download only snapshots registered in next repo https://github.com/ledgerwatch/erigon-snapshot
- node will move old blocks from DB to snapshots of 1K blocks size, then merge snapshots to bigger range, until
snapshots of 500K blocks, then automatically start seeding new snapshot
Flag `--snapshot` is compatible with `--prune` flag
## How to create new network or bootnode

View File

@ -50,7 +50,7 @@ func withIndexBucket(cmd *cobra.Command) {
}
func withSnapshotBlocks(cmd *cobra.Command) {
cmd.Flags().BoolVar(&snapshotBlocks, "experimental.snapshot", false, "")
cmd.Flags().BoolVar(&snapshotBlocks, "snapshot", false, "")
}
func withChain(cmd *cobra.Command) {

View File

@ -622,7 +622,7 @@ var (
}
SnapshotSyncFlag = cli.BoolFlag{
Name: "experimental.snapshot",
Name: "snapshot",
Usage: "Enabling experimental snapshot sync",
}
SnapshotKeepBlocksFlag = cli.BoolFlag{

View File

@ -56,7 +56,7 @@ services:
- "8551:8551"
restart: unless-stopped
downloader: # Service to download/seed historical data (need only if you use --experimental.snapshot)
downloader: # Service to download/seed historical data (need only if you use --snapshot)
image: thorax/erigon:${TAG:-latest}
command: downloader ${DOWNLOADER_FLAGS-} --datadir=/home/erigon/.local/share/erigon --downloader.api.addr=0.0.0.0:9093
pid: service:erigon # Use erigon's PID namespace. It's required to open Erigon's DB from another process (RPCDaemon local-mode)

View File

@ -139,8 +139,8 @@ func (s Snapshot) String() string {
}
var (
FlagSnapshot = "experimental.snapshot"
FlagSnapshotKeepBlocks = "experimental.snapshot.keepblocks"
FlagSnapshot = "snapshot"
FlagSnapshotKeepBlocks = "snapshot.keepblocks"
)
func NewSnapshotCfg(enabled, keepBlocks bool) Snapshot {

View File

@ -962,7 +962,6 @@ func DownloadAndIndexSnapshotsIfNeed(s *StageState, ctx context.Context, tx kv.R
if err := cfg.snapshots.ReopenIndices(); err != nil {
return fmt.Errorf("ReopenIndices: %w", err)
}
}
// Create .idx files
if cfg.snapshots.IndicesAvailable() < cfg.snapshots.SegmentsAvailable() {
@ -982,6 +981,7 @@ func DownloadAndIndexSnapshotsIfNeed(s *StageState, ctx context.Context, tx kv.R
return fmt.Errorf("ReopenIndices: %w", err)
}
}
}
if s.BlockNumber == 0 {
logEvery := time.NewTicker(logInterval)