Pruning for: exec, log_index, tx_lookup, history stages (#2399)
* Pruning for: exec, log_index, tx_lookup, history stages
* Pruning for: exec, log_index, tx_lookup, history stages
* Pruning for: exec, log_index, tx_lookup, history stages
* Pruning for: exec, log_index, tx_lookup, history stages
* add tvm flag
* save
* db migration for storage mode
add flag --prune=
remove flag --storage-mode=
add flag --experiments=tevm,...
rename integration set_storage_mode to set_prune
* fix
* forward move of stages must skip everything before PruneTo
* keep in db progress of prune method
* keep in db progress of prune method
* simplify logs
* simplify logs
* simplify logs
* fix test
* simplify logs
* simplify logs
* simplify logs
* simplify logs
* remove callTraceSet as dupsort
use etl transform for txlookup prune
remove some logs
* cleanup tests a bit
* print_stages and eth_sync to show prune progress
* fix print_stages
* add readme about --prune.to flag
* more docs
* add --prune.history.older and other flags support
* fix migration on empty db
* better toString
* better toString
2021-07-20 20:03:19 +00:00
|
|
|
Integration - tool to run Erigon stages in custom way: run/reset single stage, run all stages but reorg every X blocks,
|
|
|
|
etc...
|
|
|
|
|
|
|
|
## Examples
|
2020-09-11 10:33:46 +00:00
|
|
|
|
2021-04-19 07:25:26 +00:00
|
|
|
All commands require parameter `--datadir=<datadir>` - I will skip it for readability.
|
2020-09-11 10:33:46 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
integration --help
|
2021-03-04 02:41:32 +00:00
|
|
|
integration print_stages
|
2020-09-11 10:33:46 +00:00
|
|
|
|
|
|
|
# Run single stage
|
|
|
|
integration stage_senders
|
|
|
|
integration stage_exec
|
|
|
|
integration stage_exec --block=1_000_000 # stop at 1M block
|
|
|
|
integration stage_hash_state
|
2021-03-04 02:41:32 +00:00
|
|
|
integration stage_trie
|
2020-09-11 10:33:46 +00:00
|
|
|
integration stage_history
|
|
|
|
integration stage_tx_lookup
|
|
|
|
|
2021-03-04 02:41:32 +00:00
|
|
|
# Unwind single stage 10 blocks backward
|
|
|
|
integration stage_exec --unwind=10
|
|
|
|
|
2020-09-11 10:33:46 +00:00
|
|
|
# Drop data of single stage
|
|
|
|
integration stage_exec --reset
|
|
|
|
integration stage_history --reset
|
Pruning for: exec, log_index, tx_lookup, history stages (#2399)
* Pruning for: exec, log_index, tx_lookup, history stages
* Pruning for: exec, log_index, tx_lookup, history stages
* Pruning for: exec, log_index, tx_lookup, history stages
* Pruning for: exec, log_index, tx_lookup, history stages
* add tvm flag
* save
* db migration for storage mode
add flag --prune=
remove flag --storage-mode=
add flag --experiments=tevm,...
rename integration set_storage_mode to set_prune
* fix
* forward move of stages must skip everything before PruneTo
* keep in db progress of prune method
* keep in db progress of prune method
* simplify logs
* simplify logs
* simplify logs
* fix test
* simplify logs
* simplify logs
* simplify logs
* simplify logs
* remove callTraceSet as dupsort
use etl transform for txlookup prune
remove some logs
* cleanup tests a bit
* print_stages and eth_sync to show prune progress
* fix print_stages
* add readme about --prune.to flag
* more docs
* add --prune.history.older and other flags support
* fix migration on empty db
* better toString
* better toString
2021-07-20 20:03:19 +00:00
|
|
|
|
|
|
|
# Unwind single stage N blocks backward
|
|
|
|
integration stage_exec --unwind=N
|
|
|
|
integration stage_history --unwind=N
|
|
|
|
|
|
|
|
# Run stage prune to block N
|
|
|
|
integration stage_exec --prune.to=N
|
|
|
|
integration stage_history --prune.to=N
|
2023-07-06 04:31:59 +00:00
|
|
|
|
|
|
|
# Exec blocks, but don't commit changes (loose them)
|
|
|
|
integration stage_exec --no-commit
|
|
|
|
...
|
2020-09-11 10:33:46 +00:00
|
|
|
|
2023-03-17 00:38:38 +00:00
|
|
|
# Run tx replay with domains [requires 6th stage to be done before run]
|
|
|
|
integration state_domains --chain goerli --last-step=4 # stop replay when 4th step is merged
|
|
|
|
integration read_domains --chain goerli account <addr> <addr> ... # read values for given accounts
|
|
|
|
|
2020-09-11 10:33:46 +00:00
|
|
|
# hack which allows to force clear unwind stack of all stages
|
|
|
|
clear_unwind_stack
|
|
|
|
```
|
|
|
|
|
2021-03-04 02:41:32 +00:00
|
|
|
## For testing run all stages in "N blocks forward M blocks re-org" loop
|
|
|
|
|
|
|
|
Pre-requirements of `state_stages` command:
|
Pruning for: exec, log_index, tx_lookup, history stages (#2399)
* Pruning for: exec, log_index, tx_lookup, history stages
* Pruning for: exec, log_index, tx_lookup, history stages
* Pruning for: exec, log_index, tx_lookup, history stages
* Pruning for: exec, log_index, tx_lookup, history stages
* add tvm flag
* save
* db migration for storage mode
add flag --prune=
remove flag --storage-mode=
add flag --experiments=tevm,...
rename integration set_storage_mode to set_prune
* fix
* forward move of stages must skip everything before PruneTo
* keep in db progress of prune method
* keep in db progress of prune method
* simplify logs
* simplify logs
* simplify logs
* fix test
* simplify logs
* simplify logs
* simplify logs
* simplify logs
* remove callTraceSet as dupsort
use etl transform for txlookup prune
remove some logs
* cleanup tests a bit
* print_stages and eth_sync to show prune progress
* fix print_stages
* add readme about --prune.to flag
* more docs
* add --prune.history.older and other flags support
* fix migration on empty db
* better toString
* better toString
2021-07-20 20:03:19 +00:00
|
|
|
|
2021-03-04 02:41:32 +00:00
|
|
|
- Headers/Bodies must be downloaded
|
|
|
|
- TxSenders stage must be executed
|
|
|
|
|
|
|
|
```
|
|
|
|
make all
|
2021-04-19 07:25:26 +00:00
|
|
|
./build/bin/integration state_stages --datadir=<datadir> --unwind=10 --unwind.every=20 --pprof
|
2021-03-04 02:41:32 +00:00
|
|
|
integration reset_state # drops all stages after Senders stage (including it's db tables DB tables)
|
|
|
|
```
|
|
|
|
|
|
|
|
For example:
|
Pruning for: exec, log_index, tx_lookup, history stages (#2399)
* Pruning for: exec, log_index, tx_lookup, history stages
* Pruning for: exec, log_index, tx_lookup, history stages
* Pruning for: exec, log_index, tx_lookup, history stages
* Pruning for: exec, log_index, tx_lookup, history stages
* add tvm flag
* save
* db migration for storage mode
add flag --prune=
remove flag --storage-mode=
add flag --experiments=tevm,...
rename integration set_storage_mode to set_prune
* fix
* forward move of stages must skip everything before PruneTo
* keep in db progress of prune method
* keep in db progress of prune method
* simplify logs
* simplify logs
* simplify logs
* fix test
* simplify logs
* simplify logs
* simplify logs
* simplify logs
* remove callTraceSet as dupsort
use etl transform for txlookup prune
remove some logs
* cleanup tests a bit
* print_stages and eth_sync to show prune progress
* fix print_stages
* add readme about --prune.to flag
* more docs
* add --prune.history.older and other flags support
* fix migration on empty db
* better toString
* better toString
2021-07-20 20:03:19 +00:00
|
|
|
|
2020-09-11 10:33:46 +00:00
|
|
|
```
|
2021-03-04 02:41:32 +00:00
|
|
|
--unwind=1 --unwind.every=10 # 10 blocks forward, 1 block back, 10 blocks forward, ...
|
|
|
|
--unwind=10 --unwind.every=1 # 1 block forward, 10 blocks back, 1 blocks forward, ...
|
|
|
|
--unwind=10 # 10 blocks back, then stop
|
|
|
|
--integrity.fast=false --integrity.slow=false # it performs DB integrity checks each step. You can disable slow or fast checks.
|
|
|
|
--block # stop at exact blocks
|
|
|
|
--chaindata.reference # When finish all cycles, does comparison to this db file.
|
2020-09-11 10:33:46 +00:00
|
|
|
```
|
|
|
|
|
Pruning for: exec, log_index, tx_lookup, history stages (#2399)
* Pruning for: exec, log_index, tx_lookup, history stages
* Pruning for: exec, log_index, tx_lookup, history stages
* Pruning for: exec, log_index, tx_lookup, history stages
* Pruning for: exec, log_index, tx_lookup, history stages
* add tvm flag
* save
* db migration for storage mode
add flag --prune=
remove flag --storage-mode=
add flag --experiments=tevm,...
rename integration set_storage_mode to set_prune
* fix
* forward move of stages must skip everything before PruneTo
* keep in db progress of prune method
* keep in db progress of prune method
* simplify logs
* simplify logs
* simplify logs
* fix test
* simplify logs
* simplify logs
* simplify logs
* simplify logs
* remove callTraceSet as dupsort
use etl transform for txlookup prune
remove some logs
* cleanup tests a bit
* print_stages and eth_sync to show prune progress
* fix print_stages
* add readme about --prune.to flag
* more docs
* add --prune.history.older and other flags support
* fix migration on empty db
* better toString
* better toString
2021-07-20 20:03:19 +00:00
|
|
|
## "Wrong trie root" problem - temporary solution
|
2021-03-04 02:41:32 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
make all
|
2021-04-19 07:25:26 +00:00
|
|
|
./build/bin/integration stage_hash_state --datadir=<datadir> --reset
|
|
|
|
./build/bin/integration stage_trie --datadir=<datadir> --reset
|
2021-03-04 02:41:32 +00:00
|
|
|
# Then run TurobGeth as usually. It will take 2-3 hours to re-calculate dropped db tables
|
2023-07-04 02:45:36 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Copy data to another db
|
|
|
|
|
|
|
|
```
|
|
|
|
1. Stop Erigon
|
2023-07-05 02:35:04 +00:00
|
|
|
2. Create new db, by starting erigon in new directory: with option --datadir /path/to/copy-to/
|
|
|
|
(set new --db.pagesize option if need)
|
2023-07-04 02:45:36 +00:00
|
|
|
3. Stop Erigon again after about 1 minute (Steps 2 and 3 create a new empty db in /path/to/copy-to/chaindata )
|
|
|
|
4. Build integration: cd erigon; make integration
|
|
|
|
5. Run: ./build/bin/integration mdbx_to_mdbx --chaindata /existing/erigon/path/chaindata/ --chaindata.to /path/to/copy-to/chaindata/
|
2023-07-29 05:08:38 +00:00
|
|
|
6. cp -R /existing/erigon/path/snapshots /path/to/copy-to/snapshots
|
2024-01-09 15:34:47 +00:00
|
|
|
7. start erigon in new datadir as usually
|
2023-07-28 01:28:47 +00:00
|
|
|
```
|
|
|
|
|
2023-07-29 05:08:38 +00:00
|
|
|
## Clear bad blocks markers table in the case some block was marked as invalid after some error
|
2023-07-28 01:28:47 +00:00
|
|
|
It allows to process this blocks again
|
|
|
|
```
|
|
|
|
1. ./build/bin/integration clear_bad_blocks --datadir=<datadir>
|
2021-03-04 02:41:32 +00:00
|
|
|
```
|