Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

lisk_snapshot.sh update take2 #73

Merged
merged 10 commits into from
Feb 16, 2017
Merged

lisk_snapshot.sh update take2 #73

merged 10 commits into from
Feb 16, 2017

Conversation

Gr33nDrag0n69
Copy link
Contributor

@Gr33nDrag0n69 Gr33nDrag0n69 commented Feb 15, 2017

lisk_snapshot.sh changelog

  • Change value of failed snapshot in progress from 24 hours to 30 minutes.
  • Added dropdb on target database before exit
  • Added missing test in waiting loop for stalled/failure detection
  • Added forced full vacuum to eliminate the need for lot of freespace during process.
  • Added -m params to allow custom delay between vacuum. (Instead of default 5 minutes)
  • Added spacing in usage menu
  • Modified end of script cleanup section.
  • Move stall values to minutes and defined as variables
  • Added date to start of each output line. ("now" function)
  • Added locks directory creation (on snapshot server only, keep client clean and will be useful for future scripts)
  • Replace PID check by lock file implementation

### lisk_snapshot.sh changelog

- Change value of failed snapshot in progress from 24 hours to 30
minutes.
- Added dropdb on target database before exit
- Added missing test in waiting loop for stalled/failure detection
- Added -v switch ( forced full vacuum ) to eliminate the need for lot
of freespace during process.
- Added -m params to allow custom delay between vacuum. (Instead of
default 5 minutes)
- Added spacing in usage menu
- Modified end of script cleanup section.
- Move stall values to minutes and defined as variables
- Added date to start of each output line.
@Gr33nDrag0n69 Gr33nDrag0n69 changed the title Gr33n's update take2 Gr33n update take2 Feb 15, 2017
@Gr33nDrag0n69 Gr33nDrag0n69 changed the title Gr33n update take2 lisk_snapshot.sh update take2 Feb 15, 2017
@Gr33nDrag0n69
Copy link
Contributor Author

Gr33nDrag0n69 commented Feb 15, 2017

Now that basic script is updated, I started troubleshooting the last implematation for reccuring execution each 3 minutes for better cronjob efficiency. Using the PID as a lock file work only in command line. When it's run as cronjob the test never detect the already running instance. (issue) I will replace the PID test by a lock file (like initialy proposed) during the week. The 2nd advantage of a lock file is the fact that it can be set at start and remove at the end without the possibility of a period of time the script is running but not the node instance.

Copy link
Contributor

@Isabello Isabello left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the flag for checking if vacuum is enabled or not. we will deploy vacuuming universally for all systems.

fi

MINUTES=$(( MINUTES + 1 ))
if [ "$PGSQL_VACUUM" == "Y" ] 2> /dev/null; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We dont need the flag, we should just force vacuuming mem_rounds on all deployments for consistency purposes. Adding this complexity creates more troubleshooting hurdles that are unneccessary

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No

Copy link
Contributor Author

@Gr33nDrag0n69 Gr33nDrag0n69 Feb 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove the -v switch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And by the way, the switch is there tp allow poeple to skip the functionnality. Can I remember you that you said yourself in the chat when I proposed this modification: No, I don't have the problem myself so I don't need this functionnaility.

done
echo -e '\nSnapshot verification process completed at '"$(date)"
echo -e "\n$( date +'%Y-%m-%d %H:%M:%S' ) Snapshot verification process completed"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please turn this date command into a callable function to improve readability

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aceept the pull request and modify it later if it's so important to you. I won.'t modify.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im asking you to modify it to meet our standards, this is the purpose of a code review process.

esac
done
}

usage() {
echo "Usage: $0 [-t <snapshot.json>] [-s <config.json>] [-b <backup directory>] [-d <days to keep>] [-r <round>] [-g]"
echo -e "\nUsage: $0 [-t <snapshot.json>] [-s <config.json>] [-b <backup directory>] [-d <days to keep>] [-r <round>] [-g] [-v] [-m <vacuum delay>]\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this flag and just set vaccuum to always on using a hardcoded cycle of 15-30 minutes or so.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No

Copy link
Contributor Author

@Gr33nDrag0n69 Gr33nDrag0n69 Feb 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-v is ok to remove but -m will stay with default value 3

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not need a flag to adjust it, we can establish standards for all systems instead.

@Isabello Isabello self-assigned this Feb 15, 2017
@Gr33nDrag0n69
Copy link
Contributor Author

Removed -v
Changelog updated

@Gr33nDrag0n69
Copy link
Contributor Author

Attacking lock file implementation and initial testing tonight

@Gr33nDrag0n69
Copy link
Contributor Author

I just understood why there is so much double quotes in the script

@Gr33nDrag0n69
Copy link
Contributor Author

early testing working great so far, will report back tommorow for final confirmation

@Gr33nDrag0n69
Copy link
Contributor Author

everything is working fine. (3 auto-snap using lock file without bug) no more commit planned on this pull request.

}

parse_option "$@"
now() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this.

@Isabello Isabello merged commit 2270f91 into LiskArchive:development Feb 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants