Re: pg_rewind tests - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: pg_rewind tests
Date
Msg-id CAB7nPqS9CWD=xDb6uUGCbL7id+sDY0b9f9Q7N-AGZK3zmk010Q@mail.gmail.com
Whole thread Raw
In response to pg_rewind tests  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: pg_rewind tests
List pgsql-hackers


On Tue, Mar 31, 2015 at 9:59 AM, Peter Eisentraut <peter_e@gmx.net> wrote:
There are some small issues with the pg_rewind tests.

This technique

check: all
        $(prove_check) :: local
        $(prove_check) :: remote

for passing arguments to "prove" does not work with the tools included
in Perl 5.8.

While sorting out the portability issues in the TAP framework during the
9.4 release cycle, we had set 5.8 as the oldest Perl version that is
supported.  (It's the Perl version in RHEL 5.)  I suggest using
environment variables instead, unless we want to change that.

That's good to know. And I think that by using environment variables it is necessary to pass an additional flag to prove_check (see PG_PROVE_TEST_MODE) in the patch attached because prove_check kicks several instructions, a command mkdir to begin with.
 
Moreover,

    if ($test_mode == "local")
    ...
    elsif ($test_mode == "remote")

don't work, because those are numerical comparisons, not string
comparisons.  So the remote branch is never actually run.

That's "eq" I guess.
 
Finally, RewindTest.pm should use

use strict;
use warnings;

and the warnings caused by that should be addressed.
 
All those things addressed give more or less the patch attached.

While looking at that I noticed two additional issues:
- In remote mode, the connection string to the promoted standby was incorrect when running pg_rewind, leading to connection errors
- At least in my environment, a sleep of 1 after the standby promotion was not sufficient to make the tests work.
Regards,
--
Michael
Attachment

pgsql-hackers by date:

Previous
From: Jehan-Guillaume de Rorthais
Date:
Subject: Re: Maximum number of WAL files in the pg_xlog directory
Next
From: Kyotaro HORIGUCHI
Date:
Subject: Re: vac truncation scan problems