dev-db/pgbouncer 1.54-r1 installs an init.d script which a restart function which hints on being able to do an online restart: restart() { if [ -n "${UNIX_SOCKET_DIR}" ] ; then ebegin "Performing online restart of PgBouncer" start-stop-daemon --start \ --pidfile ${PIDFILE} \ --user pgbouncer \ --exec /usr/bin/pgbouncer -- -q -d -R "${INIFILE}" eend $? else stop && start fi } but man 8 runscript states restart Stop and start the service, including dependencies. This cannot be overridden. See the description of the RC_CMD variable below for the method to make your service behave differ‐ ently when restart is being executed. In fact when simulating the run: db2 ~ # bash db2 ~ # . /etc/conf.d/pgbouncer db2 ~ # get_config() { > [ -f "${INIFILE}" ] || eend 1 "'${INIFILE}' not found" > > eval echo $(sed -e 's:;.*::' "${INIFILE}" | \ > awk '$1 == "'$1'" { print ($2 == "=" ? $3 : $2) }') > } db2 ~ # PIDFILE="$(get_config pidfile)" db2 ~ # UNIX_SOCKET_DIR="$(get_config unix_socket_dir)" db2 ~ # echo $PIDFILE /run/pgbouncer/pgbouncer.pid db2 ~ # echo $UNIX_SOCKET_DIR /run/postgresql db2 ~ # if [ -n "${UNIX_SOCKET_DIR}" ] ; then > echo THEN > else > echo ELSE > fi THEN db2 ~ # exit It seems it should restart online but when trying it it does an offline restart: db2 ~ # /etc/init.d/pgbouncer restart * Stopping PgBouncer (this can take up to 62 seconds) ... If possible online restarting of pgbouncer would be interesting.
Forgot this, which is important: If online restart of pgbouncer is hard to make restart() should be zapped to avoid further confussions. I believe ( looking at nginx, which has online upgrade too ) it can be moved to another function name, but do not know enough about init scripts to assert it.
When I first wrote this ebuild, restart was flaky as well, but I implemented it according to what upstream suggested. You're correct in that we shouldn't really advertise online if it isn't. I can possibly have a look at getting this working later this week.
Just wanted to post an update. I've done some minor changes to the ebuild, but are waiting for pgbouncer 1.6 which should close in. Hopefully I'll have everything set by then. It should be a significant upgrade.
If you're still interested in progress/development; I'm waiting for 1.6 to go from rc to release: https://github.com/markokr/pgbouncer-dev
any news? Upstream has currently pgbouncer_1_7_2 https://github.com/markokr/pgbouncer-dev/releases
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=855a26cb2380f20a90fe1873e3a35cb685320af4 commit 855a26cb2380f20a90fe1873e3a35cb685320af4 Author: Aaron W. Swenson <titanofold@gentoo.org> AuthorDate: 2017-12-21 11:51:28 +0000 Commit: Aaron W. Swenson <titanofold@gentoo.org> CommitDate: 2017-12-21 11:51:28 +0000 dev-db/pgbouncer: Bump and improve Added optional dep on OpenSSL. Fixed logrotate script to always succeed. Address potential DoS by letting s-s-d handle the pidfile creation and backgrounding of pgbouncer. Dropped restart in initscript as online restart can’t be used with s-s-d and the pidfile isn’t writeable by the pgbouncer user. Bug: https://bugs.gentoo.org/500546 Bug: https://bugs.gentoo.org/577784 Bug: https://bugs.gentoo.org/629334 Closes: https://bugs.gentoo.org/565218 Package-Manager: Portage-2.3.13, Repoman-2.3.3 dev-db/pgbouncer/Manifest | 1 + dev-db/pgbouncer/files/pgbouncer-1.8-dirs.patch | 32 +++++++++ dev-db/pgbouncer/files/pgbouncer.initd-r1 | 83 ++++++++++++++++++++++++ dev-db/pgbouncer/metadata.xml | 26 ++++---- dev-db/pgbouncer/pgbouncer-1.8.1.ebuild | 86 +++++++++++++++++++++++++ 5 files changed, 216 insertions(+), 12 deletions(-)}
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d1336fab60d57949472d66270dd14722a32e6ebd commit d1336fab60d57949472d66270dd14722a32e6ebd Author: Aaron W. Swenson <titanofold@gentoo.org> AuthorDate: 2018-01-24 02:30:19 +0000 Commit: Aaron W. Swenson <titanofold@gentoo.org> CommitDate: 2018-01-24 02:30:19 +0000 dev-db/pgbouncer: Clean out old and insecure Closes: https://bugs.gentoo.org/577784 Closes: https://bugs.gentoo.org/500546 Bug: https://bugs.gentoo.org/629334 Package-Manager: Portage-2.3.19, Repoman-2.3.6 dev-db/pgbouncer/Manifest | 1 - dev-db/pgbouncer/files/pgbouncer-dirs.patch | 26 --------- dev-db/pgbouncer/files/pgbouncer.initd | 88 ----------------------------- dev-db/pgbouncer/metadata.xml | 1 - dev-db/pgbouncer/pgbouncer-1.7.2.ebuild | 82 --------------------------- 5 files changed, 198 deletions(-)