Package: pgbouncer
Severity: normal
Tags: patch

pgbouncer has an amazing feature to not drop connections when it is upgraded,
but the debian packaging does not make use of it.  This patch does.  Note that
it will take two upgrades before it takes effect, because the prerm of the
current package will still stop pgbouncer before the upgrade.

-- System Information:
Debian Release: wheezy/sid
  APT prefers oneiric-updates
  APT policy: (500, 'oneiric-updates'), (500, 'oneiric-security'), (500, 
'oneiric'), (100, 'oneiric-backports')
Architecture: amd64 (x86_64)

Kernel: Linux 3.0.0-12-generic (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Index: debian/rules
===================================================================
--- debian/rules	(revision 721)
+++ debian/rules	(working copy)
@@ -7,6 +7,7 @@
 
 DEB_CONFIGURE_EXTRA_FLAGS := --bindir=/usr/sbin 
 DEB_UPDATE_RCD_PARAMS := defaults 20 18
+DEB_DH_INSTALLINIT_ARGS := -R
 
 clean::
 	find doc -name "pgbouncer.*" -exec rm {} \;
Index: debian/init
===================================================================
--- debian/init	(revision 721)
+++ debian/init	(working copy)
@@ -64,6 +64,14 @@
     done
 }
 
+d_restart() {
+	if [ ${START} -eq 1 ]; then
+		su -c "$DAEMON -R $OPTS 2> /dev/null &" - postgres
+	else
+		log_warning_msg "pgbouncer daemon disabled in /etc/default/pgbouncer"
+	fi
+}
+
 case "$1" in
     start)
 	log_daemon_msg Starting pgbouncer
@@ -87,8 +95,7 @@
 	;;
     restart)
 	log_daemon_msg "Restarting pgbouncer" pgbouncer
-	d_stop
-	d_start
+	d_restart
 	log_end_msg $?
 	;;
     try-restart)

Reply via email to