forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to reset a db to execute from genesis (MystenLabs#10013)
## Description This PR allows us to reset a db to execute from genesis. The main use case of this would be to run an instance from genesis using a db snapshot. Follow the below steps to test: 1. Get a db snapshot. Either generate one by running stress locally and enabling db checkpoints or download one from S3 bucket (pretty big in size though). 2. Download the snapshot for the epoch you want to restore to the local disk. You will find one snapshot per epoch in the S3 bucket. We need to place the snapshot in the dir where config is pointing to. If `db-config` in fullnode.yaml is `/opt/sui/db/authorities_db` and we want to restore from epoch 10, we want to copy the snapshot to `/opt/sui/db/authorities_db`like this: ```aws s3 cp s3://myBucket/dir /opt/sui/db/authorities_db/ --recursive —exclude “*” —include “epoch_10*” ``` 3. Mark downloaded snapshot as live: ```mv /opt/sui/db/authorities_db/epoch_10 /opt/sui/db/authorities_db/live``` 4. Reset the downloaded db to execute from genesis with: ```cargo run --package sui-tool -- db-tool --db-path /opt/sui/db/authorities_db/live reset-db``` 5. Start the sui full node: ```cargo run --release --bin sui-node -- --config-path ~/db_checkpoints/fullnode.yaml``` 6. A sample fullnode.yaml config would be: ``` --- db-path: /opt/sui/db/authorities_db network-address: /ip4/0.0.0.0/tcp/8080/http json-rpc-address: "0.0.0.0:9000" websocket-address: "0.0.0.0:9001" metrics-address: "0.0.0.0:9184" admin-interface-port: 1337 enable-event-processing: true grpc-load-shed: ~ grpc-concurrency-limit: ~ p2p-config: listen-address: "0.0.0.0:8084" genesis: genesis-file-location: <path to genesis blob for the network> authority-store-pruning-config: num-latest-epoch-dbs-to-retain: 3 epoch-db-pruning-period-secs: 3600 num-epochs-to-retain: 18446744073709551615 max-checkpoints-in-batch: 200 max-transactions-in-batch: 1000 use-range-deletion: true ``` ## Test Plan By running it locally
- Loading branch information
1 parent
8059d72
commit 39dc1b8
Showing
4 changed files
with
94 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters