pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: pg_basebackup: Add tests for -X option
2+ messages / 2 participants
[nested] [flat]

* pgsql: pg_basebackup: Add tests for -X option
@ 2015-07-29 00:34  Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 1 reply; 2+ messages in thread

From: Peter Eisentraut @ 2015-07-29 00:34 UTC (permalink / raw)
  To: pgsql-committers

pg_basebackup: Add tests for -X option

Reviewed-by: Michael Paquier <michael.paquier@gmail.com>

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/90102bb538831fca734cc9fa1450b97c7d4e1190

Modified Files
--------------
src/bin/pg_basebackup/t/010_pg_basebackup.pl |   13 ++++++++++++-
src/test/perl/TestLib.pm                     |   10 ++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: pgsql: pg_basebackup: Add tests for -X option
@ 2015-07-29 06:58  Michael Paquier <michael.paquier@gmail.com>
  parent: Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2015-07-29 06:58 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-committers

On Wed, Jul 29, 2015 at 9:34 AM, Peter Eisentraut <peter_e@gmx.net> wrote:
> pg_basebackup: Add tests for -X option

One thing that I noticed after more tests is that actually the LSN
position restart_lsn is not necessarily 8-character long as this
tests, but it can be 7-character length as well:
like($lsn, qr!^0/[0-9A-Z]{8}$!, 'restart LSN of slot has advanced');
So you may have random failures depending on how much the LSN has
advanced depending on the number of base backups taken on the server
during the tests (found out the problem on Windows because we need to
skip some tests as there is no symlink support). I would suggest that
instead of checking the format of restart_lsn we encapsulate it within
pg_xlogfile_name and check if result has a correct length of 24
characters with characters 0-9A-F, like in the patch attached.
Sorry for not noticing that before, attached is a patch to fix the issue.
-- 
Michael

-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

Attachments:

20150729_fix_tap_basebackup.patch (binary/octet-stream, 1.0K) download diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl index b605fa9..eb5f047 100644 --- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl +++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl @@ -168,8 +168,8 @@ my $lsn = psql 'postgres', q{SELECT restart_lsn FROM pg_replication_slots WHERE is($lsn, '', 'restart LSN of new slot is null'); command_ok([ 'pg_basebackup', '-D', "$tempdir/backupxs_sl", '-X', 'stream', '-S', 'slot1' ], 'pg_basebackup -X stream with replication slot runs'); -$lsn = psql 'postgres', q{SELECT restart_lsn FROM pg_replication_slots WHERE slot_name = 'slot1'}; -like($lsn, qr!^0/[0-9A-Z]{8}$!, 'restart LSN of slot has advanced'); +$lsn = psql 'postgres', q{SELECT pg_xlogfile_name(restart_lsn) FROM pg_replication_slots WHERE slot_name = 'slot1'}; +like($lsn, qr!^[0-9A-F]{24}$!, 'restart LSN of slot has advanced'); command_ok([ 'pg_basebackup', '-D', "$tempdir/backupxs_sl_R", '-X', 'stream', '-S', 'slot1', '-R' ], 'pg_basebackup with replication slot and -R runs');
^ permalink raw reply [nested|flat] 2+ messages in thread


end of thread, other threads:[~2015-07-29 06:58 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-07-29 00:34 pgsql: pg_basebackup: Add tests for -X option Peter Eisentraut <peter_e@gmx.net>
2015-07-29 06:58 ` Michael Paquier <michael.paquier@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox