From c697ec13c23ac3246513a7473d56fa80da168fc6 Mon Sep 17 00:00:00 2001 From: Roy Li Date: Fri, 3 Nov 2023 14:33:19 -0400 Subject: [PATCH] Improve usability of snapshots saved by snapshotting node --- .github/workflows/protocol-build-and-push-snapshot.yml | 1 + .github/workflows/protocol-build-and-push.yml | 1 + protocol/old_clob_dump | 1 + protocol/testing/snapshotting/snapshot.sh | 5 ++++- 4 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 protocol/old_clob_dump diff --git a/.github/workflows/protocol-build-and-push-snapshot.yml b/.github/workflows/protocol-build-and-push-snapshot.yml index 51ffb241932..239b0514c13 100644 --- a/.github/workflows/protocol-build-and-push-snapshot.yml +++ b/.github/workflows/protocol-build-and-push-snapshot.yml @@ -3,6 +3,7 @@ name: Protocol Build & Push Image to AWS ECR on: # yamllint disable-line rule:truthy push: branches: + - roy/snap - main - 'release/[a-z]+/v0.[0-9]+.x' # e.g. release/protocol/v0.1.x - 'release/[a-z]+/v[0-9]+.x' # e.g. release/protocol/v1.x diff --git a/.github/workflows/protocol-build-and-push.yml b/.github/workflows/protocol-build-and-push.yml index b2463692f73..b41f0dff8f1 100644 --- a/.github/workflows/protocol-build-and-push.yml +++ b/.github/workflows/protocol-build-and-push.yml @@ -3,6 +3,7 @@ name: Protocol Build & Push Image to AWS ECR on: # yamllint disable-line rule:truthy push: branches: + - roy/snap - main - 'release/[a-z]+/v0.[0-9]+.x' # e.g. release/protocol/v0.1.x - 'release/[a-z]+/v[0-9]+.x' # e.g. release/protocol/v1.x diff --git a/protocol/old_clob_dump b/protocol/old_clob_dump new file mode 100644 index 00000000000..59c395addf5 --- /dev/null +++ b/protocol/old_clob_dump @@ -0,0 +1 @@ +Tree s/k:clob/ version: 43 diff --git a/protocol/testing/snapshotting/snapshot.sh b/protocol/testing/snapshotting/snapshot.sh index f7223f4769f..064f6847993 100755 --- a/protocol/testing/snapshotting/snapshot.sh +++ b/protocol/testing/snapshotting/snapshot.sh @@ -87,6 +87,9 @@ sleep 10 dydxprotocold init --chain-id=${CHAIN_ID} --home /dydxprotocol/chain/local_node local_node curl -X GET ${genesis_file_rpc_address}/genesis | jq '.result.genesis' > /dydxprotocol/chain/local_node/config/genesis.json +# Set pruning to prune all but the last two states. Prevents snapshots from getting too big. +sed -i 's/pruning = "default"/pruning = "nothing"/' /dydxprotocol/chain/local_node/config/app.toml + setup_cosmovisor # TODO: add metrics around snapshot upload latency/frequency/success rate @@ -99,7 +102,7 @@ while true; do kill -TERM $(pidof cosmovisor) log_this "Creating new snapshot" - SNAP_NAME=$(echo "${CHAIN_ID}_$(date '+%Y-%m-%d-%M-%H').tar.gz") + SNAP_NAME=$(echo "${CHAIN_ID}_$(date '+%Y-%m-%d-%H-%M')_$(jq -r '.height' /dydxprotocol/chain/local_node/data/priv_validator_state.json).tar.gz") tar cvzf ${SNAP_PATH}/${SNAP_NAME} ${DATA_PATH} aws s3 cp ${SNAP_PATH}/${SNAP_NAME} s3://${s3_snapshot_bucket}/ --region ap-northeast-1 --debug || true rm -rf ${SNAP_PATH}/${SNAP_NAME}