Re: pgwin32_open returning EINVAL

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Zeugswetter Andreas ADI SD <Andreas(dot)Zeugswetter(at)s-itsolutions(dot)at>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Gregory Stark <stark(at)enterprisedb(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Martijn van Oosterhout <kleptog(at)svana(dot)org>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgwin32_open returning EINVAL
Date: 2007-12-20 08:32:38
Message-ID: 20071220083238.GA21084@svr2.hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 19, 2007 at 07:50:29PM -0500, Tom Lane wrote:
> Magnus Hagander <magnus(at)hagander(dot)net> writes:
> > Updated version attached. Comments on the wording of the messages are also
> > welcome ;-)
>
> Well, since you asked ;-) ... I don't particularly like this.

Well, it's better to have you say that before than to have to redo it
later, of course. Especially when we're this close to translation deadline,
and it contains new strings to translate :-P

> 1. Doesn't distinguish SHARING_VIOLATION from LOCK_VIOLATION.
> We might want to know that.

Yeah, I had that fixed locally already.

> 2. Do we really want this to be WARNING? LOG seems a better idea,
> since it's not warning about anything the client app did wrong.

I put it as warning because I wanted to be sure the admin notices. If your
database is hanging 5+ seconds to open a file, you have a *big* problem,
and you need to fix it. Just putting it as LOG will probably make it much
more likely it's missed.

Is there a guideline somewhere that says what shuld be WARNING and what
should be LOG in general? If not, maybe there shuold be? ;-)

> 3. Doesn't follow the message style guide: shoehorning two sentences
> into errmsg() is surely not compliant. Perhaps
>
> errmsg: could not open file \"%s\": sharing violation
> OR errmsg: could not open file \"%s\": lock violation
>
> errdetail: Continuing to retry for up to 30 seconds.
>
> errhint: OK as you have it.

Yeah, Alvaro pointed parts of that out on IM already. Updated before
application, pending discussion about log level above.

ereport(WARNING,
(errmsg("could not open file \"%s\": %s violation", fileName,
(GetLastError() ==
ERROR_SHARING_VIOLATION)?_("sharing"):_("lock")),
errdetail("Continuing to retry for 30 seconds."),
errhint("You may have antivirus, backup or similar software
interfering with the database.")));

Is _("") the proper way to get a translatable string in like that, or is
there a better way?

//Magnus

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gokulakannan Somasundaram 2007-12-20 08:36:49 Re: [HACKERS] Proposal for Null Bitmap Optimization(for TrailingNULLs)
Previous Message Oleg Bartunov 2007-12-20 08:21:13 Re: Benchmark for GiST index?