Skip to content

Commit

Permalink
Merge PR: produce snapshot s0 & s1 (#996)
Browse files Browse the repository at this point in the history
* upd

* snapshot

* fix bug of s1, execute one more cmd

Co-authored-by: liang xiong <[email protected]>
  • Loading branch information
zhongqiuwood and liang xiong authored Aug 31, 2021
1 parent dd37964 commit 55a0bed
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions dev/snapshot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash

HOME=$1
VERSION=$2
CMD=exchaind
NUM_EXECUTIONS=2

set -e
set -o errexit
set -a
set -m

killbyname() {
NAME=$1
ps -ef|grep "$NAME"|grep -v grep |awk '{print "kill -9 "$2", "$8}'
ps -ef|grep "$NAME"|grep -v grep |awk '{print "kill -9 "$2}' | sh
echo "All <$NAME> killed!"
}


killbyname exchaind
killbyname exchaincli

set -x # activate debugging


if [ "$1" == "-h" ];
then
echo "Usage: exchaind [home] [s0|s1]"
exit 0
fi

if [ -z "$HOME" ];
then
echo specify home directory first please
exit -1
fi

if [ -z "$VERSION" ];
then
echo specify version first please
exit -1
fi


echo using $VERSION mode

if [ "$VERSION" = "s0" ];
then
for (( i=0; i<NUM_EXECUTIONS; i++ ))
do
echo runing $i-th times...
$CMD data prune-compact all --home $HOME
done
rm -rf $HOME/data/cs.wal
rm -rf $HOME/data/tx_index.db
rm -rf $HOME/data/evidence.db
rm -rf $HOME/data/watch.db
else
for (( i=0; i<NUM_EXECUTIONS; i++ ))
do
echo runing $i-th times...
$CMD data prune-compact state --home $HOME
done
rm -rf $HOME/data/watch.db
fi

0 comments on commit 55a0bed

Please sign in to comment.