Re: Server is not getting started with log level as debug5 on master after commit 3147ac

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Server is not getting started with log level as debug5 on master after commit 3147ac
Date: 2013-11-23 06:32:14
Message-ID: CAA4eK1Lr6FmMR1nqn+4yapGYJgY=3wU_3fnmZEp4a4gb6Ap-Dg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 22, 2013 at 9:30 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)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 Content-Type Size
pvsnprintf_issue_v2.patch application/octet-stream 689 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message mohsen soodkhah mohammadi 2013-11-23 06:48:22 COPY TO
Previous Message Amit Kapila 2013-11-23 05:15:09 Re: Proof of concept: standalone backend with full FE/BE protocol