RE: [bug fix] pg_rewind creates corrupt WAL files, and the standby cannot catch up the primary

From: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
To: 'Michael Paquier' <michael(at)paquier(dot)xyz>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: [bug fix] pg_rewind creates corrupt WAL files, and the standby cannot catch up the primary
Date: 2018-03-09 08:22:49
Message-ID: 0A3221C70F24FB45833433255569204D1F9000B9@G01JPEXMBYT05
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

From: Michael Paquier [mailto:michael(at)paquier(dot)xyz]
> I see. So the only reason why this flag exists is that if a file is large
> enough so as it is split into multiple chunks, then the first unlink will
> work but not the successive ones. One chunk can be at most
> 1 million bytes, which is why it is essential for WAL segments. Instead
> of ignoring *all* errors, let's ignore only ENOENT and rename ignore_error
> to missing_ok as well.
>
> You need to update the comment in receiveFileChunks where an entry gets
> deleted with basically what I mentioned above, say:
> "If a file has been deleted on the source, remove it on the target as well.
> Note that multiple unlink() calls may happen on the same file if multiple
> data chunks are associated with it, hence ignore unconditionally anything
> missing. If this file is not a relation data file, then it has been already
> truncated when creating the file chunk list at hte previous execution of
> the filemap."
>
> Adding also a comment on top of remove_target_file to explain what
> missing_ok does would be nice to keep track of what the code should do.

Thanks for reviewing. All done.

Regards
Takayuki Tsunakawa

Attachment Content-Type Size
pg_rewind_corrupt_wal_v2.patch application/octet-stream 3.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2018-03-09 08:32:59 Re: WIP: a way forward on bootstrap data
Previous Message Dilip Kumar 2018-03-09 08:12:04 Problem while setting the fpw with SIGHUP