AntelopeIO / DUNES

Docker Utilities for Node Execution
Other
26 stars 17 forks source link

Support clearing dirty db failure at Dune start #172

Closed pliuwu1998 closed 1 year ago

pliuwu1998 commented 1 year ago

The new flag added is --rmdirtydb, as seen in ./dune --help

To manually create a dirty db flag for a running node say test_node1, create an interactive bash shell of the dune_container by using docker exec -it dune_container bash , and then on the interactive bash shell, use 'ps aux|grep nodeos' to find the PID of the nodeos, and then use kill - 9 PID to force kill the running nodeos. Then if you use './dune --start test_node1', you would see 'system_errorEEE: Database dirty flag set'.

After using ./dune --start test_node1 --rmdirtydb, the test_node1 can be launched with no error, and using 'less test_node1.out' on dune_container's /app, you can see Replay occur first for all the blocks in /app/nodes/test_node1/blocks/ before generating new blocks again.

The latest code is to use --replay-blockchain option rather than 'rm -rf data_dir/state/' of the nodoes whose database dirty flag was set in order to clear the database dirty flag.

Reminder: The latest code has change in scripts/start_node.sh, to test it locally, root bootstrap.sh has to run to update the docker image before issuing any ./dune --start command.

pliuwu1998 commented 1 year ago

Thanks, Kevin! scripts/start_node.sh stipulates the way to start nodeos, in order to make programming easy, I choose to rm -rf of state dir, rather than modifiy the nodeos launch method to clear the dirty db flag

heifner commented 1 year ago

Your check for dirty db is likely fine, but there is a leap util for checking if db is dirty.

pliuwu1998 commented 1 year ago

Thanks, @heifner ! would you please tell me which LEAP util can be used to see if db is dirty?

heifner commented 1 year ago

Thanks, @heifner ! would you please tell me which LEAP util can be used to see if db is dirty?

./leap-util chain-state last-shutdown-state

pliuwu1998 commented 1 year ago

Thanks, @heifner ! would you please tell me which LEAP util can be used to see if db is dirty?

./leap-util chain-state last-shutdown-state

Above command is probably implemented in the latest LEAP, but old-version leap-util is still installed in dune_container, and above command currently will result in error output.