Re: pg_basebackup stream xlog to tar

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_basebackup stream xlog to tar
Date: 2016-10-23 13:52:39
Message-ID: CAB7nPqQ_YCZFBs9W1vqOwveX+5A1aRqnVk3Hvk+b9HyqLq50=Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Oct 23, 2016 at 10:30 PM, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
> On Mon, Oct 17, 2016 at 7:37 AM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
> wrote:
>> > But independent of this patch, actually putting that test in for non-tar
>> > mode would probably not be a bad idea -- if that breaks, it's likely
>> > both
>> > break, after all.
>>
>> Agreed (you were able to break only tar upthread with your patch). One
>> way to do that elegantly would be to:
>> 1) extend slurp_dir to return only files that have a matching pattern.
>> That's not difficult to do:
>> --- a/src/test/perl/TestLib.pm
>> +++ b/src/test/perl/TestLib.pm
>> @@ -184,10 +184,14 @@ sub generate_ascii_string
>>
>> sub slurp_dir
>> {
>> - my ($dir) = @_;
>> + my ($dir, $match_pattern) = @_;
>> opendir(my $dh, $dir)
>> or die "could not opendir \"$dir\": $!";
>> my @direntries = readdir $dh;
>> + if (defined($match_pattern))
>> + {
>> + @direntries = grep($match_pattern, @direntries);
>> + }
>> closedir $dh;
>> return @direntries;
>> }
>> Sorting them at the same time may be a good idea..
>> 2) Add an option to pg_xlogdump to be able to output its output to a
>> file. That would be awkward to rely on grabbing the output data from a
>> pipe... On Windows particularly. Thinking about it, would that
>> actually be useful to others? That's not a complicated patch.
>
> I think both of those would be worthwhile. Just for the testability in
> itself, but such a flag to pg_xlogdump would probably be useful in other
> cases as well, beyond just the testing.

Looking quickly at the code, it does not seem that complicated... I
may just send patches tomorrow for all those things and be done with
it, all that on its new dedicated thread.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2016-10-23 13:57:39 pgsql: Remove extra comma at end of enum list
Previous Message Magnus Hagander 2016-10-23 13:30:00 Re: pg_basebackup stream xlog to tar