Re: Style of file error messages

Lists: pgsql-hackers
From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Style of file error messages
Date: 2007-05-30 16:18:02
Message-ID: 200705301818.02837.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Just to get an opinion, which is better:

could not open transaction log file "%s": %m
could not open control file "%s": %m
could not open data file "%s": %m
could not open temporary file "%s": %m
could not open whatever file "%s": %m

or just:

could not open file "%s": %m

It seems to me that by the time you get to a file error message of this
level, the higher-level purpose of the file is pretty irrelevant.
(Specific exceptions might exist.) Log analysis tools might also
prefer a uniform format.

Anyway, some consistency either way would be nice.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Style of file error messages
Date: 2007-05-30 17:12:08
Message-ID: 465DB068.6070701@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Peter Eisentraut wrote:
> Just to get an opinion, which is better:
>
> could not open transaction log file "%s": %m
> could not open control file "%s": %m
> could not open data file "%s": %m
> could not open temporary file "%s": %m
> could not open whatever file "%s": %m
>
> or just:
>
> could not open file "%s": %m
>
> It seems to me that by the time you get to a file error message of this
> level, the higher-level purpose of the file is pretty irrelevant.
> (Specific exceptions might exist.) Log analysis tools might also
> prefer a uniform format.
>
> Anyway, some consistency either way would be nice.

Since we use a relative path to $PGDATA I think that:

could not open file "%s" : %m

is plenty.

Sincerely,

Joshua D. Drake

>

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Style of file error messages
Date: 2007-05-30 17:21:25
Message-ID: 5564.1180545685@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Just to get an opinion, which is better:
> could not open whatever file "%s": %m
> or just:
> could not open file "%s": %m

> It seems to me that by the time you get to a file error message of this
> level, the higher-level purpose of the file is pretty irrelevant.

I like the more verbose variant myself, and would argue that indeed our
message style guidelines mandate it:

45.3.9. Type of the object

When citing the name of an object, state what kind of object it is.

Rationale: Otherwise no one will know what "foo.bar.baz" refers to.

A seasoned developer might only need the file name to guess what kind of
file it is, but other people could probably use the help.

regards, tom lane


From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Peter Eisentraut" <peter_e(at)gmx(dot)net>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Style of file error messages
Date: 2007-05-30 20:07:49
Message-ID: 87ps4ihy7e.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> A seasoned developer might only need the file name to guess what kind of
> file it is, but other people could probably use the help.

I think Peter's argument is that what kind of file it is really doesn't help a
regular user. Nonetheless I agree strongly. Even if it doesn't actually make
any practical difference it's one less thing to wonder about and one more
anchor for a user to hold onto when trying to understand what's going on.

I know I feel better knowing what part is actually broken on my car than just
having a dummy light come on even if I'm going to go to the same garage either
way.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Style of file error messages
Date: 2007-05-31 00:22:14
Message-ID: 465E1536.4020904@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Gregory Stark wrote:
> "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
>
>> A seasoned developer might only need the file name to guess what kind of
>> file it is, but other people could probably use the help.
>
> I think Peter's argument is that what kind of file it is really doesn't help a
> regular user. Nonetheless I agree strongly. Even if it doesn't actually make
> any practical difference it's one less thing to wonder about and one more
> anchor for a user to hold onto when trying to understand what's going on.
>
> I know I feel better knowing what part is actually broken on my car than just
> having a dummy light come on even if I'm going to go to the same garage either
> way.

In general I agree with your assessment but... In PostgreSQL everything
is structured so formally in terms of the filesystem that the verbosity
seems overkill. I mean think about it:

pg_clog/0FEa
pg_xlog/9283521535
base/124765/23569.1

It isn't really that opaque. Besides, *anybody* who gets the errors we
are talking about is going to post that they can't open the specific
file right?

Sincerely,

Joshua D. Drake

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/