Commit 57d4f134 authored by Martin Pitt's avatar Martin Pitt

* 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)
parent ca674303
......@@ -14,8 +14,16 @@ postgresql-common (96) UNRELEASED; urgency=low
* 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.
-- Martin Pitt <mpitt@debian.org> Sat, 14 Feb 2009 21:06:06 +0100
* 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)
-- Martin Pitt <mpitt@debian.org> Sun, 15 Feb 2009 14:51:57 +0100
postgresql-common (95) experimental; urgency=low
......
......@@ -138,11 +138,9 @@ 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 = get_cluster_socketdir $version, $cluster;
error("Port conflict: another instance is already running on $sockdir with port $info{'port'}");
}
# get locale used by initdb
......
......@@ -6,7 +6,7 @@ require File::Temp;
use lib 't';
use TestLib;
use Test::More tests => 162;
use Test::More tests => 164;
use lib '/usr/share/postgresql-common';
use PgCommon;
......@@ -243,9 +243,20 @@ ok ((system "pg_createcluster $version other >/dev/null") == 0,
set_cluster_port $version, 'other', '5432';
is ((exec_as 'postgres', "pg_ctlcluster $version main start"), 0,
'pg_ctlcluster: main cluster on conflicting port starts');
# clusters can run side by side on different socket directories
set_cluster_socketdir $version, 'other', '/tmp';
PgCommon::set_conf_value $version, 'other', 'postgresql.conf',
'listen_addresses', ''; # otherwise they will conflict on TCP socket
is ((exec_as 'postgres', "pg_ctlcluster $version other start"), 0,
'pg_ctlcluster: other cluster starts on conflicting port, but different socket dirs');
is ((exec_as 'postgres', "pg_ctlcluster $version other stop"), 0);
# ... but will give an error when running on the same port
set_cluster_socketdir $version, 'other', '/var/run/postgresql';
like_program_out 'postgres', "pg_ctlcluster $version other start", 1,
qr/conflict.*8.3\/main/,
'pg_ctlcluster other cluster on conflicting port fails';
qr/Port conflict:.*port 5432/,
'pg_ctlcluster other cluster fails on conflicting port and same socket dir';
is_program_out 'postgres', "pg_ctlcluster $version main stop", 0, '',
'stopping main cluster';
is ((exec_as 'postgres', "pg_ctlcluster $version other start"), 0,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment