Re: pgsql: Add TAP tests for pg_verify_checksums

From: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Michael Banck <michael(dot)banck(at)credativ(dot)de>, Andres Freund <andres(at)anarazel(dot)de>, Postgres hackers <pgsql-hackers(at)postgresql(dot)org>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: pgsql: Add TAP tests for pg_verify_checksums
Date: 2018-10-15 01:11:42
Message-ID: be1a1ae4-ff0b-eff6-99bc-0d5ab8a810c3@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 10/14/2018 06:41 PM, Michael Paquier wrote:
> On Sun, Oct 14, 2018 at 10:24:55AM -0400, Andrew Dunstan wrote:
>> [snip]
> Thanks a lot for the review, Andrew!
>
>> This code now seems redundant:
>>
>>      if (strcmp(fn, ".") == 0 ||
>>          strcmp(fn, "..") == 0)
>>          return true;
> Indeed. I have renamed skipfile() to isRelFileName on the way, which
> looks better in the context.
>
>> I would probably reverse the order of these two tests. It might not make any
>> difference, assuming fn is never an empty string, but it seems more logical
>> to me.
>>
>> +    /* good to go if only digits */
>> +    if (fn[pos] == '\0')
>> +        return false;
>> +    /* leave if no digits */
>> +    if (pos == 0)
>> +        return true;
> No objections to that. Done.
>
>> It also looks to me like the check for a segment number doesn't ensure
>> there is at least one digit, so "123." might pass, but I could be
>> wrong. In any case, there isn't a test for that, and there probably
>> should be.
> You are right here. This name pattern has been failing. Fixed in the
> attached. I have added "123_" and "123_." as extra patterns to check.
>
> What do you think about the updated version attached?

Looks good to me.

cheers

andrew

--
Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2018-10-15 07:59:28 pgsql: Fixes for "Glyph not available" warnings from FOP
Previous Message Michael Paquier 2018-10-14 22:41:38 Re: pgsql: Add TAP tests for pg_verify_checksums

Browse pgsql-hackers by date

  From Date Subject
Next Message Hironobu SUZUKI 2018-10-15 02:03:04 Re: pgbench - add pseudo-random permutation function
Previous Message Thomas Munro 2018-10-14 22:49:47 Re: [RFC] Removing "magic" oids