-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve usability of snapshots saved by snapshotting node #749
Conversation
WalkthroughThe recent changes in the snapshot.sh script involve modifying the pruning configuration in the app.toml file and updating the SNAP_NAME variable. The pruning configuration is now set to "nothing", and the SNAP_NAME variable has been modified to include the date and time in the filename. Changes
TipsChat with CodeRabbit Bot (
|
c697ec1
to
7257a8e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- protocol/testing/snapshotting/snapshot.sh (2 hunks)
Additional comments: 2
protocol/testing/snapshotting/snapshot.sh (2)
87-91: The change to the pruning configuration is a significant one. It's important to ensure that this change doesn't negatively impact the performance of the system or lead to unexpected behavior. Please verify that the system can handle retaining only the last two states and that this doesn't cause any issues with data integrity or system performance.
105-108: The change to include the date and time in the snapshot filename is a good one for usability. However, it's important to ensure that this change doesn't cause any issues with existing systems that might be expecting the old filename format. Please verify that all systems that interact with these snapshots can handle the new filename format.
Also update the script here? Probably should just pull the snapshot script from this repo in the setup script in the other repos that push up docker images. |
@@ -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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 = "everything"/' /dydxprotocol/chain/local_node/config/app.toml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment on line 90 and the code on line 91 seem to contradict each other. The comment says that all but the last two states are pruned, but the code sets pruning to "everything". Please verify this.
- # Set pruning to prune all but the last two states. Prevents snapshots from getting too big.
- sed -i 's/pruning = "default"/pruning = "everything"/' /dydxprotocol/chain/local_node/config/app.toml
+ # Set pruning to prune everything. Prevents snapshots from getting too big.
+ sed -i 's/pruning = "default"/pruning = "everything"/' /dydxprotocol/chain/local_node/config/app.toml
Commitable suggestion
[!IMPORTANT]
Carefully review the code before committing. Make sure it correctly replaces the highlighted code, has no missing lines and indentaion issues.
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 = "everything"/' /dydxprotocol/chain/local_node/config/app.toml | |
# Set pruning to prune everything. Prevents snapshots from getting too big. | |
sed -i 's/pruning = "default"/pruning = "everything"/' /dydxprotocol/chain/local_node/config/app.toml |
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').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} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new format for SNAP_NAME is a good improvement for better sorting and access of snapshots. However, consider using a more precise timestamp format to avoid potential conflicts if two snapshots are created within the same minute.
- SNAP_NAME=$(echo "${CHAIN_ID}_$(date '+%Y-%m-%d-%H-%M').tar.gz")
+ SNAP_NAME=$(echo "${CHAIN_ID}_$(date '+%Y-%m-%d-%H-%M-%S').tar.gz")
Commitable suggestion
[!IMPORTANT]
Carefully review the code before committing. Make sure it correctly replaces the highlighted code, has no missing lines and indentaion issues.
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').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} | |
kill -TERM $(pidof cosmovisor) | |
log_this "Creating new snapshot" | |
- SNAP_NAME=$(echo "${CHAIN_ID}_$(date '+%Y-%m-%d-%H-%M').tar.gz") | |
+ SNAP_NAME=$(echo "${CHAIN_ID}_$(date '+%Y-%m-%d-%H-%M-%S').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} |
Changelist
Test Plan
Author/Reviewer Checklist
state-breaking
label.PrepareProposal
orProcessProposal
, manually add the labelproposal-breaking
.feature:[feature-name]
.backport/[branch-name]
.refactor
,chore
,bug
.