[HACKERS] Reversed sync check in pg_receivewal - Mailing list pgsql-hackers

From Magnus Hagander
Subject [HACKERS] Reversed sync check in pg_receivewal
Date
Msg-id CABUevEyTV2gMpfnraS=uPSX+JXRwSR+1Jt5DLYb1bcQ8DEVS+A@mail.gmail.com
Whole thread Raw
Responses Re: [HACKERS] Reversed sync check in pg_receivewal  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [HACKERS] Reversed sync check in pg_receivewal  (Michael Paquier <michael.paquier@gmail.com>)
Re: [HACKERS] Reversed sync check in pg_receivewal  (Aleksander Alekseev <a.alekseev@postgrespro.ru>)
List pgsql-hackers
This bug seems to have snuck in there with the introduction of walmethods. AFAICT we are testing the result of sync() backwards, so whenever a partial segment exists for pg_receivewal, it will fail. It will then unlink the file, so when it retries 5 seconds later it works.

It also doesn't log the failure. Oops.

Attached patch reverses the check, and adds a failure message. I'd appreciate a quick review in case I have the logic backwards in my head...

--
Attachment

pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: [HACKERS] [PATCH v1] Add and report the new "in_hot_standby" GUC pseudo-variable.
Next
From: Magnus Hagander
Date:
Subject: Re: [pgsql-www] [HACKERS] Small issue in online devel documentation build