Gurjeet Singh singh.gurjeet at gmail.com
Thu Jul 10 21:28:51 PDT 2008
A newer version. Instead of dying upon connection failure, it registers a
problem so that the problem can be reported at the end.

A note for the archive readers: I noticed that every 'equal to' sign is
being shown as 'equal to3D'in the archives, so if you are trying to pick up
this patch from archives, do proper search/replce before applying this
patch.

<patch>
*** test_slony_state-dbi.pl     2008-07-10 11:13:48.000000000 +0000
--- test_slony_state-dbi.pl.my  2008-07-10 14:56:01.000000000 +0000
***************
*** 73,80 ****
--- 73,85 ----
  sub test_node {
    my ($node, $dsn) =3D @_;

+   $dsn =3D "dbi:Pg:$dsn";
+
    print "\nTests for node $node - DSN =3D
$dsn\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n";

+   $dbh =3D DBI->connect($dsn) or add_problem ($node, "Could not connect.",
+                qq{Could not connect to node $node using DSN: $dsn}) and
return;
+
    my $listener_query =3D "select relpages, reltuples from
pg_catalog.pg_class where relname =3D 'pg_listener';";
    my $res =3D $dbh->prepare($listener_query);
    $res->execute();
</patch>

Best regards,
On Thu, Jul 10, 2008 at 7:32 AM, Gurjeet Singh <singh.gurjeet at gmail.com>
wrote:

> Forgot the fix to the dsn string. I am not sure if we should be replacing
> the spaces in the dsn string with a semicolon, so I'll leave that decision
> upto the hackers.
>
> *** test_slony_state-dbi.pl     2008-07-10 11:13:48.000000000 +0000
> --- test_slony_state-dbi.pl.my  2008-07-10 11:32:26.000000000 +0000
> ***************
> *** 73,80 ****
> --- 73,84 ----
>   sub test_node {
>     my ($node, $dsn) =3D @_;
>
> +   $dsn =3D "dbi:Pg:$dsn";
> +
>     print "\nTests for node $node - DSN =3D
> $dsn\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n";
>
> +   $dbh =3D DBI->connect($dsn) or die "Unable to connect: $DBI::errstr\n=
";
> +
>     my $listener_query =3D "select relpages, reltuples from
> pg_catalog.pg_class where relname =3D 'pg_listener';";
>     my $res =3D $dbh->prepare($listener_query);
>     $res->execute();
>
>
> On Thu, Jul 10, 2008 at 7:14 AM, Gurjeet Singh <singh.gurjeet at gmail.com>
> wrote:
>
>> Hi All,
>>
>>     I am no expert in either Slony or Perl, but it seems to me that the
>> perl script should be connecting to each node in turn and then executing=
 the
>> test_node script; but it is not. The script performs only one connection
>> throughout it's lifetime, and that is to the $initialDSN. The docs at
>> http://www.slony.info/documentation/monitoring.html say:
>>
>> <snip>
>> The script then rummages through sl_path to find all of the nodes in the
>> cluster, and the DSNs to allow it to, in turn, connect to each of them.
>> </snip>
>>
>> Is it possible that I am using an old version of the scripts? I took the
>> script from:
>>
>>
>> http://main.slony.info/viewcvs/viewvc.cgi/slony1-engine/tools/test_slony=
_state-dbi.pl?revision=3D1.5&content-type=3Dtext%2Fplain
>>
>>   and the $Id $ tag says:
>>
>> # $Id: test_slony_state-dbi.pl,v 1.5 2007/01/02 19:34:11 cbbrowne Exp $
>>
>>
>>     Here's a patch to fix the test_node function, if you consider this to
>> be a bug:
>>
>> <patch>
>>
>> *** test_slony_state-dbi.pl     2008-07-08 21:43:37.000000000 +0000
>> --- test_slony_state-dbi.pl.my  2008-07-10 11:05:09.000000000 +0000
>> ***************
>> *** 75,80 ****
>> --- 75,82 ----
>>
>>     print "\nTests for node $node - DSN =3D
>> $dsn\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n";
>>
>> +   $dbh =3D DBI->connect($dsn) or die "Unable to connect: $DBI::errstr\=
n";
>> +
>>     my $listener_query =3D "select relpages, reltuples from
>> pg_catalog.pg_class where relname =3D 'pg_listener';";
>>     my $res =3D $dbh->prepare($listener_query);
>>     $res->execute();
>>
>> </patch>
>>
>> Best regards,
>>
>> --
>> gurjeet[.singh]@EnterpriseDB.com
>> singh.gurjeet@{ gmail | hotmail | indiatimes | yahoo }.com
>>
>> EnterpriseDB http://www.enterprisedb.com
>>
>> Mail sent from my BlackLaptop device
>
>
>
>
> --
> gurjeet[.singh]@EnterpriseDB.com
> singh.gurjeet@{ gmail | hotmail | indiatimes | yahoo }.com
>
> EnterpriseDB http://www.enterprisedb.com
>
> Mail sent from my BlackLaptop device
>



-- =

gurjeet[.singh]@EnterpriseDB.com
singh.gurjeet@{ gmail | hotmail | indiatimes | yahoo }.com

EnterpriseDB      http://www.enterprisedb.com

Mail sent from my BlackLaptop device
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.slony.info/pipermail/slony1-patches/attachments/20080711/=
33a93f6c/attachment.htm


More information about the Slony1-patches mailing list