Re: Calling pgstat_report_wait_end() before ereport(ERROR)

2019-04-16 Thread Michael Paquier
On Tue, Apr 16, 2019 at 08:03:22PM +0900, Masahiko Sawada wrote: > Agreed. There are also some code which raise an ERROR after close a > transient file but I think it's a good idea to not include them for > safety. It looks to me that the patch you proposed cleans places as > much as we can do.

Re: Calling pgstat_report_wait_end() before ereport(ERROR)

2019-04-16 Thread Tom Lane
Michael Paquier writes: > In short, I tend to think that the attached is an acceptable cleanup. > Thoughts? WFM. regards, tom lane

Re: Calling pgstat_report_wait_end() before ereport(ERROR)

2019-04-16 Thread Masahiko Sawada
On Tue, Apr 16, 2019 at 2:45 PM Michael Paquier wrote: > > On Fri, Apr 12, 2019 at 10:06:41PM +0900, Masahiko Sawada wrote: > > But I think that's not right, I've checked the code. If the startup > > process failed in that function it raises a FATAL and recovery fails, > > and if checkpointer

Re: Calling pgstat_report_wait_end() before ereport(ERROR)

2019-04-16 Thread Masahiko Sawada
On Fri, Apr 12, 2019 at 11:05 PM Tom Lane wrote: > > Masahiko Sawada writes: > > There are something like the following code in many places in PostgreSQL > > code. > > ... > > Since we eventually call > > pgstat_report_wait_end() in AbortTransaction(). I think that we don't > > need to call

Re: Calling pgstat_report_wait_end() before ereport(ERROR)

2019-04-15 Thread Michael Paquier
On Fri, Apr 12, 2019 at 10:06:41PM +0900, Masahiko Sawada wrote: > But I think that's not right, I've checked the code. If the startup > process failed in that function it raises a FATAL and recovery fails, > and if checkpointer process does then it calls > pgstat_report_wait_end() in

Re: Calling pgstat_report_wait_end() before ereport(ERROR)

2019-04-12 Thread Tom Lane
Masahiko Sawada writes: > There are something like the following code in many places in PostgreSQL code. > ... > Since we eventually call > pgstat_report_wait_end() in AbortTransaction(). I think that we don't > need to call pgstat_report_wait_end() if we're going to raise an error > just after

Re: Calling pgstat_report_wait_end() before ereport(ERROR)

2019-04-12 Thread Masahiko Sawada
On Fri, Apr 12, 2019 at 9:07 PM Michael Paquier wrote: > > On Fri, Apr 12, 2019 at 07:27:44PM +0900, Masahiko Sawada wrote: > > As far as I know there are three places where call > > pgstat_report_wait_end before ereport(ERROR): two in twophase.c > > andanother in copydir.c(at L199). Since we

Re: Calling pgstat_report_wait_end() before ereport(ERROR)

2019-04-12 Thread Michael Paquier
On Fri, Apr 12, 2019 at 07:27:44PM +0900, Masahiko Sawada wrote: > As far as I know there are three places where call > pgstat_report_wait_end before ereport(ERROR): two in twophase.c > andanother in copydir.c(at L199). Since we eventually call > pgstat_report_wait_end() in AbortTransaction(). I

Calling pgstat_report_wait_end() before ereport(ERROR)

2019-04-12 Thread Masahiko Sawada
Hi, There are something like the following code in many places in PostgreSQL code. pgstat_report_wait_start(WAIT_EVENT_xxx); if (write(...) != len) { ereport(ERROR, ...); } pgstat_report_wait_end(); Almost of these places don't call pgstat_report_wait_end() before ereport(ERROR) but some