Merge ~cjwatson/launchpad:update-pgkill-scripts into launchpad:master
Status: | Merged |
---|---|
Approved by: | Colin Watson |
Approved revision: | b166ec5666414d420f38d2047164282dafe2c6b8 |
Merge reported by: | Otto Co-Pilot |
Merged at revision: | not available |
Proposed branch: | ~cjwatson/launchpad:update-pgkill-scripts |
Merge into: | launchpad:master |
Diff against target: |
143 lines (+34/-29) 2 files modified
utilities/pgkillactive.py (+12/-8) utilities/pgkillidle.py (+22/-21) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ines Almeida | Approve | ||
Review via email: mp+448725@code.launchpad.net |
Commit message
Update pgkillactive and pgkillidle scripts
Description of the change
Similar versions of these scripts exist in lp:losa-db-scripts and lp:postgresql-charm, and have been a bit more actively maintained there. However, it's still useful to have copies of these in the Launchpad tree, since the simplest way to migrate some current cron jobs from production will be to run these as part of the `launchpad-admin` charm.
Sync our versions up more closely with those maintained elsewhere, making the following changes:
* Exclude the current process from being killed.
* Terminate the PostgreSQL backend process remotely using `pg_terminate_
* Make the `pgkillidle -u` option match either the username or the application name.
* Update `pgkillidle` for `pg_stat_activity` changes in PostgreSQL >= 9.2.
* Make `pgkillidle` print a little more information on the process being killed.
* Minor changes to docstrings and help text.
Looks good