Re: Server is not getting started with log level as debug5 on master after commit 3147ac - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Server is not getting started with log level as debug5 on master after commit 3147ac
Date
Msg-id CAA4eK1Lr6FmMR1nqn+4yapGYJgY=3wU_3fnmZEp4a4gb6Ap-Dg@mail.gmail.com
Whole thread Raw
In response to Server is not getting started with log level as debug5 on master after commit 3147ac  (Amit Kapila <amit.kapila16@gmail.com>)
Responses Re: Re: Server is not getting started with log level as debug5 on master after commit 3147ac  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Fri, Nov 22, 2013 at 9:30 AM, Amit Kapila <amit.kapila16@gmail.com> wrote:
> In master branch, server is not getting started with log level as debug5.
>
> Simple steps to reproduce the problem:
> a. initdb -D ..\..\Data
> b. change log_min_messages = debug5 in postgresql.conf
> c. start server (pg_ctl start -D ..\..\Data)  -- server doesn't get started
>
> Relevant message on server console:
> DEBUG:  mapped win32 error code 2 to 2
> FATAL:  could not open recovery command file "recovery.conf": No error
>
> This problem occurs only in Windows, but the cause of problem is generic.
>
> I could think of below possible ways to fix the problem:
> a. in function pvsnprintf(), save the errno before setting it to 0 and
> then before exiting function reset it back to saved errno. I think
> this is sane because in function pvsnprintf, if any error occurs due
> to which errno is changed, it will not return control, so errno will
> not be required by callers.
> b. we can change the callers like _dosmaperr() who have responsibility
> to save errno for their callers.
>
> Patch with approach a) is attached with mail, we can change code as
> per approach b) or any other better method as well, but for now I have
> prepared patch with approach a), as I could not see any problem with
> it.

Again looking at it, I think better fix would be to restore 'errno'
from 'edata->saved_errno' in errfinish() incase the control returns
back to caller (elevel <= WARNING). It seems to me that this fix is
required anyway because if we return from errfinish (ereport/elog) to
caller, it should restore back 'errno', as caller might need to take
some action based on errno.
Patch to restore 'errno' in errfinish() is attached with this mail.

Any better ideas for fixing this issue?

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

Attachment

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Proof of concept: standalone backend with full FE/BE protocol
Next
From: mohsen soodkhah mohammadi
Date:
Subject: COPY TO