Your message dated Sun, 15 Feb 2009 17:17:07 +0000
with message-id <e1lykc7-0007cj...@ries.debian.org>
and subject line Bug#514132: fixed in postgresql-common 96
has caused the Debian Bug report #514132,
regarding pg_ctlcluster conflicts with instances with different 
unix_socket_directory settings
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
514132: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=514132
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: postgresql-common
Version: 94
Severity: Serious

pg_ctlcluster conflicts with instances with the same configured port, but different listen_addresses and unix_socket_directory:

$ grep port db*/postgresql*
db2/postgresql.conf:port = 5432
db/postgresql.conf:port = 5432

$ grep listen_addresses db*/postgresql*
db2/postgresql.conf:listen_addresses = '192.168.0.111'
db/postgresql.conf:listen_addresses = 'localhost'

$ grep unix_socket_directory db*/postgresql*
db2/postgresql.conf:unix_socket_directory = '/var/run/postgresql/8.3/db2'
db/postgresql.conf:unix_socket_directory = '/var/run/postgresql/8.3/db'

The culprit seems to be cluster_port_running(), called by pg_ctlcluster in the subroutine start(), to make sure the specified unix socket is not accidently used by another running instance:

[...]
   # check conflicting port
   foreach my $v (get_versions) {
       foreach my $c (get_version_clusters $v) {
error("Port conflict: cluster $v/$c is already running on port " . $info{'port'}) if cluster_port_running $v, $c, $info{'port'};
       }
   }
[...]

This makes it impossible to use several instances on different listen_addresses with the same port number. It seems to me the whole check is far too harsh anyways: it might be sufficient to check against the current unix socket directory only. If the connect() to this unix socket succeeds, then there is another instance using this unix socket already. I propose the following patch to fix the behavior of pg_ctlcluster:

diff --git a/pg_ctlcluster b/pg_ctlcluster
index 531e6b2..335e4f4 100755
--- a/pg_ctlcluster
+++ b/pg_ctlcluster
@@ -244,11 +244,12 @@ sub start {
    start_check_pid_file;

    # check conflicting port
-    foreach my $v (get_versions) {
-        foreach my $c (get_version_clusters $v) {
- error("Port conflict: cluster $v/$c is already running on port " . - $info{'port'}) if cluster_port_running $v, $c, $info{'port'};
-        }
+    if (cluster_port_running $version, $cluster, $info{'port'}) {
+
+ my $sockdir = PgCommon::get_conf_value $version, $cluster, 'postgresql.conf',
+                                              'unix_socket_directory';
+ error("Port conflict: another instance is already running on ".$sockdir." with port ".$info{'port'});
+
    }

    # get locale used by initdb

--
Regards

Bernd Helmle




--- End Message ---
--- Begin Message ---
Source: postgresql-common
Source-Version: 96

We believe that the bug you reported is fixed in the latest version of
postgresql-common, which is due to be installed in the Debian FTP archive:

postgresql-client-common_96_all.deb
  to pool/main/p/postgresql-common/postgresql-client-common_96_all.deb
postgresql-common_96.dsc
  to pool/main/p/postgresql-common/postgresql-common_96.dsc
postgresql-common_96.tar.gz
  to pool/main/p/postgresql-common/postgresql-common_96.tar.gz
postgresql-common_96_all.deb
  to pool/main/p/postgresql-common/postgresql-common_96_all.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 514...@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Martin Pitt <mp...@debian.org> (supplier of updated postgresql-common package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmas...@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Sun, 15 Feb 2009 17:37:58 +0100
Source: postgresql-common
Binary: postgresql-common postgresql-client-common
Architecture: source all
Version: 96
Distribution: unstable
Urgency: low
Maintainer: Martin Pitt <mp...@debian.org>
Changed-By: Martin Pitt <mp...@debian.org>
Description: 
 postgresql-client-common - manager for multiple PostgreSQL client versions
 postgresql-common - PostgreSQL database-cluster manager
Closes: 425914 472627 481025 508977 509144 512648 514132
Changes: 
 postgresql-common (96) unstable; urgency=low
 .
   * debian/supported-versions: Add "Debian 5.0" aka Lenny.
     (Closes: #509144)
   * debian/README.Debian: Document port handling, and point to
     relevant manpages and tools. (Closes: #508977)
   * debian/README.Debian: Fix "confident" typo. (Closes: #512648)
   * Drop pg_autovacuum handling, which was only necessary for 7.4 (8.0
     and above have internal autovacuuming). This was kept for Lenny to
     allow Etch backports. This also gets rid of pg_maintenance and
     /etc/cron.d/postgresql-common. (Closes: #425914, #481025)
   * Add debian/postgresql-common.preinst: Remove obsolete conffiles
     (cronjob and /etc/postgresql-common/autovacuum.conf) on upgrade.
   * Drop support for pre-8.1 clusters, together with all hacks and
     workarounds for those. Add Conflicts: to postgresql-{7.4,8.0}, to
     ensure that this version isn't used with ancient servers any more.
   * t/030_errors.t: Check that clusters on the same port can run side
     by side if they are using different Unix socket directories and
     different TCP addresses. This reproduces #514132.
   * pg_ctlcluster: Replace overly harsh port conflict check (which
     broke clusters on the same port, but different Unix/TCP
     namespaces) with a more modest one which just checks conflict on
     the same Unix socket directory. Thanks to Bernd Helmle for the
     patch! (Closes: #514132, #472627)
   * debian/postgresql-common.postinst: Do not call pg_updatedicts with
     full path (DP 6.1).
   * pg_lsclusters, pg_upgradecluster: Fix forgotten "=back" after
     itemize list in the POD. Thanks lintian.
   * debian/compat, debian/control: Bump compat level to 6.
   * pg_updatedicts: Ensure generated tsearch dictionaries are world
     readable when being generated under umask 077.
   * debian/README.Debian: Point out incompatibility between using the
     upstream tools (initdb) and the Debian tools (pg_createcluster)
     and give some recommendations. (LP: #138793)
   * debian/maintscripts-functions: Unset $GREP_OPTIONS. Thanks to
     Carlo Calderoni for noticing!
 .
 postgresql-common (95) experimental; urgency=low
 .
   * Add automatic building of PostgreSQL tsearch/stem dictionaries:
     - Add pg_updatedicts: Build dictionaries and affix files from installed
       hunspell/myspell dictionary packages.
     - Add t/150_tsearch_stemming.t: Test cases for pg_updatedicts, tsearch
       functionality, and word stem handling.
     - t/001_packages.t: Ensure that hunspell-en-us is installed, above new
       test relies on it.
     - debian/postgresql-common.install: Install pg_updatedicts.
     - debian/rules: Create man page from pg_udpatedicts POD.
     - Add debian/postgresql-common.triggers: Register interest on
       /usr/share/myspell/dicts.
     - debian/postgresql-common.postinst: Call pg_updatedicts on upgrade to
       this version, fresh install, and our trigger.
     - debian/postgresql-common.postrm: Remove /var/cache/postgresql on purge.
     - (LP: #301770)
Checksums-Sha1: 
 8a6e4b06a746ce34e3ae91590cae5b659becf5d1 816 postgresql-common_96.dsc
 3f5a8b5521d52c109104e60d347b808ba7495ae1 107573 postgresql-common_96.tar.gz
 6bcb97fc6ac802facbe73d27212335844f378113 113752 postgresql-common_96_all.deb
 70179b49795c608bbf74be370a8560fd1110bb7e 47282 
postgresql-client-common_96_all.deb
Checksums-Sha256: 
 7475ae6baf14d4bb35b88c4974f8d1c1299a2eff6011784500820e4bee425181 816 
postgresql-common_96.dsc
 cd7929693a6d9d4474393bc746f34d4b132bbce487373226266e30e698a474a3 107573 
postgresql-common_96.tar.gz
 9d81df085c4e1287f4e98c3b1404a5605c3a3a7cc1fe60c15f79bfd1ec2612d4 113752 
postgresql-common_96_all.deb
 9d078d3756e0299ec702b8dbd274e8ca222038cd4743d8308a9c26f8722505e5 47282 
postgresql-client-common_96_all.deb
Files: 
 78e2c69b209f1c3da85990ac6e4c2cf2 816 misc optional postgresql-common_96.dsc
 382c49ef48b1e0592297cb478267e922 107573 misc optional 
postgresql-common_96.tar.gz
 8a5dd3d4f7c4ce5e28ccb13db949db92 113752 misc optional 
postgresql-common_96_all.deb
 3a0c1802a27e49df63aa6589a3b8beb0 47282 misc optional 
postgresql-client-common_96_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkmYRT4ACgkQDecnbV4Fd/IzHwCfbycCxnTs71O29RPyyB3dUsW2
0nsAn30mtNCvOFbiIV48gUUceccA3PHW
=vqXI
-----END PGP SIGNATURE-----



--- End Message ---

Reply via email to