Обсуждение: pgsql: Improve error messages in md.c.
Log Message: ----------- Improve error messages in md.c. When a filesystem operation like open() or fsync() fails, say "file" rather than "relation" when printing the filename. This makes messages that display block numbers a bit confusing. For example, in message 'could not read block 150000 of file "base/1234/5678.1"', 150000 is the block number from the beginning of the relation, ie. segment 0, not 150000th block within that segment. Per discussion, users aren't usually interested in the exact location within the file, so we can live with that. To ease constructing error messages, add FilePathName(File) function to return the pathname of a virtual fd. Modified Files: -------------- pgsql/src/backend/storage/file: fd.c (r1.149 -> r1.150) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/storage/file/fd.c?r1=1.149&r2=1.150) pgsql/src/backend/storage/smgr: md.c (r1.148 -> r1.149) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/storage/smgr/md.c?r1=1.148&r2=1.149) pgsql/src/include/storage: fd.h (r1.64 -> r1.65) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/storage/fd.h?r1=1.64&r2=1.65)
heikki@postgresql.org (Heikki Linnakangas) writes: > This makes messages that display block numbers a bit confusing. For example, > in message 'could not read block 150000 of file "base/1234/5678.1"', 150000 > is the block number from the beginning of the relation, ie. segment 0, not > 150000th block within that segment. Per discussion, users aren't usually > interested in the exact location within the file, so we can live with that. While reading your commit message, it occurred to me that perhaps a small wording tweak would help. How about 'could not read block 150000 in file "foo"', rather than "of" file foo? This states correctly that the block is *in* that file, without implying that the naming of the block is relative to the file. The distinction might be a bit too subtle to help non-native speakers of English, but it seems to me to read a little better that way. regards, tom lane
Tom Lane wrote: > While reading your commit message, it occurred to me that perhaps a > small wording tweak would help. How about 'could not read block 150000 > in file "foo"', rather than "of" file foo? This states correctly that > the block is *in* that file, without implying that the naming of the > block is relative to the file. > > The distinction might be a bit too subtle to help non-native speakers > of English, but it seems to me to read a little better that way. Heh, I had exactly the same idea, and did that in the commit already :-). I'm glad you thought of it too. Me being a non-native speaker of English myself I was not sure how it comes across to someone who is. Perhaps I should've mentioned it in the commit message though, to make note of the subtle difference for future readers of the code. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes: > Heh, I had exactly the same idea, and did that in the commit already > :-). I'm glad you thought of it too. Me being a non-native speaker of > English myself I was not sure how it comes across to someone who is. Yeah, I went and looked later and saw you'd already done it that way. Looks good. regards, tom lane