Re: BUG #14999: pg_rewind corrupts control file global/pg_control

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
Cc: TipTop Labs <office(at)tiptop-labs(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14999: pg_rewind corrupts control file global/pg_control
Date: 2018-03-05 07:54:31
Message-ID: 20180305075431.GH2266@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Fri, Mar 02, 2018 at 04:35:07PM +0100, Dmitry Dolgov wrote:
> It maybe a stupid question, but why do you need to reset errno here? Is it to
> avoid its value being carried from previous calls of `open_target_file`? In
> this case if you put the code with `errno == EACCESS` under the if condition
> `if (dstfd < 0)`, then as far as I remember you should always get relevant
> errno. At the same time maybe it's valid to reset `errno` before `open`, like
> with `getpriority`:

[ ... reads and feels stupid ...]

Of course all the checks should be where dstno is negative...

I have done a second pass on the patch, and attached is a new version.
This fixes this handling of errno and addresses some typos. I have also
fixed the test case where one of the read-only files was not properly
switched to do so. I have also added a commit log message.
--
Michael

Attachment Content-Type Size
0001-Improve-error-handling-of-configuration-files-in-pg_.patch text/x-diff 12.1 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Masahiko Sawada 2018-03-05 08:47:06 Re: BUG #14999: pg_rewind corrupts control file global/pg_control
Previous Message Michael Paquier 2018-03-05 06:13:25 Re: BUG #15096: Unable to CREATE TABLE LIKE with bigint identity column

Browse pgsql-hackers by date

  From Date Subject
Next Message Konstantin Knizhnik 2018-03-05 07:56:32 Re: Contention preventing locking
Previous Message Michael Paquier 2018-03-05 07:34:33 Re: Incorrect use of "an" and "a" in code comments and docs