Re: Tighten error control for OpenTransientFile/CloseTransientFile

2019-10-14 Thread Michael Paquier
On Fri, Oct 04, 2019 at 01:39:38PM -0700, Andres Freund wrote: > but that reasoning seems bogus to me. For one, on just about any > platform close always closes the fd, even when returning an error > (unless you pass in a bad fd, in which case it obviously doesn't). So > the reasoning that this

Re: Tighten error control for OpenTransientFile/CloseTransientFile

2019-10-04 Thread Andres Freund
Hi, On 2019-03-07 10:56:25 +0900, Michael Paquier wrote: > diff --git a/src/backend/access/heap/rewriteheap.c > b/src/backend/access/heap/rewriteheap.c > index f5cf9ffc9c..bce4274362 100644 > --- a/src/backend/access/heap/rewriteheap.c > +++ b/src/backend/access/heap/rewriteheap.c > @@ -1202,7

Re: Tighten error control for OpenTransientFile/CloseTransientFile

2019-03-08 Thread Michael Paquier
On Fri, Mar 08, 2019 at 10:23:24AM +0900, Michael Paquier wrote: > Argh... Thanks for the lookup, Alvaro. And committed, after an extra pass to beautify the whole experience. -- Michael signature.asc Description: PGP signature

Re: Tighten error control for OpenTransientFile/CloseTransientFile

2019-03-07 Thread Michael Paquier
On Thu, Mar 07, 2019 at 10:00:05PM -0300, Alvaro Herrera wrote: > I think this one needs a terminating \n. Argh... Thanks for the lookup, Alvaro. -- Michael signature.asc Description: PGP signature

Re: Tighten error control for OpenTransientFile/CloseTransientFile

2019-03-07 Thread Alvaro Herrera
On 2019-Mar-07, Michael Paquier wrote: > #else > - close(fd); > + if (close(fd)) > + { > + fprintf(stderr, _("%s: could not close file \"%s\": %s"), > + progname, ControlFilePath, strerror(errno)); > + exit(EXIT_FAILURE); > + }

Re: Tighten error control for OpenTransientFile/CloseTransientFile

2019-03-07 Thread Georgios Kokolatos
The following review has been posted through the commitfest application: make installcheck-world: tested, failed Implements feature: not tested Spec compliant: not tested Documentation:not tested The second version of this patch seems to be in order and ready for

Re: Tighten error control for OpenTransientFile/CloseTransientFile

2019-03-06 Thread Michael Paquier
On Wed, Mar 06, 2019 at 02:54:52PM +, Georgios Kokolatos wrote: > Overall the patch looks good and according to the previous > discussion fulfils its purpose. > > It might be worthwhile to also check for errors on close in > SaveSlotToPath(). Thanks for the feedback, added. I have spent

Re: Tighten error control for OpenTransientFile/CloseTransientFile

2019-03-06 Thread Robert Haas
On Fri, Mar 1, 2019 at 5:06 PM Joe Conway wrote: > Seems like it would be better to modify the arguments to > CloseTransientFile() to include the filename being closed, errorlevel, > and fail_on_error or something similar. Then all the repeated ereport > stanzas could be eliminated. Hmm. I'm

Re: Tighten error control for OpenTransientFile/CloseTransientFile

2019-03-06 Thread Georgios Kokolatos
Overall the patch looks good and according to the previous discussion fulfils its purpose. It might be worthwhile to also check for errors on close in SaveSlotToPath(). pgstat_report_wait_end(); CloseTransientFile(fd); /* rename to permanent file, fsync file and

Re: Tighten error control for OpenTransientFile/CloseTransientFile

2019-03-01 Thread Michael Paquier
On Fri, Mar 01, 2019 at 05:05:54PM -0500, Joe Conway wrote: > Seems like it would be better to modify the arguments to > CloseTransientFile() to include the filename being closed, errorlevel, > and fail_on_error or something similar. Then all the repeated ereport > stanzas could be eliminated.

Re: Tighten error control for OpenTransientFile/CloseTransientFile

2019-03-01 Thread Joe Conway
On 2/28/19 9:33 PM, Michael Paquier wrote: > Hi all, > > Joe's message here has reminded me that we have lacked a lot of error > handling around CloseTransientFile(): > https://www.postgresql.org/message-id/c49b69ec-e2f7-ff33-4f17-0eaa4f2ce...@joeconway.com > > This has been mentioned by Alvaro

Tighten error control for OpenTransientFile/CloseTransientFile

2019-02-28 Thread Michael Paquier
Hi all, Joe's message here has reminded me that we have lacked a lot of error handling around CloseTransientFile(): https://www.postgresql.org/message-id/c49b69ec-e2f7-ff33-4f17-0eaa4f2ce...@joeconway.com This has been mentioned by Alvaro a couple of months ago (cannot find the thread about that