Add --no-snapshot to disable booting a validator from a snapshot (#5050)

automerge
This commit is contained in:
Michael Vines 2019-07-11 21:03:17 -07:00 committed by Grimes
parent ebcdc06dc3
commit 9f58318fc5
1 changed files with 21 additions and 15 deletions

View File

@ -168,6 +168,7 @@ identity_keypair_path=
no_restart=0 no_restart=0
airdrops_enabled=1 airdrops_enabled=1
generate_snapshots=0 generate_snapshots=0
boot_from_snapshot=1
positional_args=() positional_args=()
while [[ -n $1 ]]; do while [[ -n $1 ]]; do
@ -185,6 +186,9 @@ while [[ -n $1 ]]; do
elif [[ $1 = --generate-snapshots ]]; then elif [[ $1 = --generate-snapshots ]]; then
generate_snapshots=1 generate_snapshots=1
shift shift
elif [[ $1 = --no-snapshot ]]; then
boot_from_snapshot=0
shift
elif [[ $1 = --replicator ]]; then elif [[ $1 = --replicator ]]; then
node_type=replicator node_type=replicator
shift shift
@ -422,22 +426,24 @@ EOF
done done
echo "Fetched genesis ledger in $SECONDS seconds" echo "Fetched genesis ledger in $SECONDS seconds"
SECONDS= if ((boot_from_snapshot)); then
echo "Rsyncing state snapshot ${rsync_entrypoint_url:?}..." SECONDS=
if ! $rsync -P "${rsync_entrypoint_url:?}"/config/state.tgz .; then echo "Rsyncing state snapshot ${rsync_entrypoint_url:?}..."
echo "State snapshot rsync failed" if ! $rsync -P "${rsync_entrypoint_url:?}"/config/state.tgz .; then
rm -f "$SOLANA_RSYNC_CONFIG_DIR"/state.tgz echo "State snapshot rsync failed"
exit rm -f "$SOLANA_RSYNC_CONFIG_DIR"/state.tgz
fi exit
echo "Fetched snapshot in $SECONDS seconds" fi
echo "Fetched snapshot in $SECONDS seconds"
SECONDS= SECONDS=
mkdir -p "$state_dir" mkdir -p "$state_dir"
( (
set -x set -x
tar -C "$state_dir" -zxf "$SOLANA_RSYNC_CONFIG_DIR"/state.tgz tar -C "$state_dir" -zxf "$SOLANA_RSYNC_CONFIG_DIR"/state.tgz
) )
echo "Extracted snapshot in $SECONDS seconds" echo "Extracted snapshot in $SECONDS seconds"
fi
) )
fi fi