Re: BufFileRead() error signalling
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>, Robert Haas <robertmhaas@gmail.com>, Ibrar Ahmed <ibrar.ahmad@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-06-05T08:14:40Z
Lists: pgsql-hackers
On Fri, Jun 05, 2020 at 06:03:59PM +1200, Thomas Munro wrote:
> I didn't change BufFileWrite() to be void, to be friendly to existing
> callers outside the tree (if there are any), though I removed all the
> code that checks the return code. We can make it void later.
Missing one entry in AppendStringToManifest(). It sounds right to not
change the signature of the routine on back-branches to any ABI
breakages. It think that it could change on HEAD.
Anyway, why are we sure that it is fine to not complain even if
BufFileWrite() does a partial write? fwrite() is mentioned at the top
of the thread, but why is that OK?
> For the future: it feels a bit like we're missing a one line way to
> say "read this many bytes and error out if you run out".
- ereport(ERROR,
- (errcode_for_file_access(),
- errmsg("could not write block %ld of temporary file:
- %m",
- blknum)));
- }
+ elog(ERROR, "could not seek block %ld temporary file", blknum);
You mean "in temporary file" in the new message, no?
+ ereport(ERROR,
+ (errcode_for_file_access(),
+ errmsg("could not write to \"%s\" : %m",
+ FilePathName(thisfile))));
Nit: "could not write [to] file \"%s\": %m" is a more common error
string.
--
Michael
Commits
-
Make BufFileWrite() void.
- f5d18862bbb3 14.0 landed
-
Fix buffile.c error handling.
- 89020a92fb62 9.5.23 landed
- 02b71f06be75 9.6.19 landed
- 95647a1c7d29 10.14 landed
- 9c14d6024365 11.9 landed
- 28ee12669944 12.4 landed
- 3e0b08c404b2 13.0 landed
- 7897e3bb902c 14.0 landed
-
Adjust WAL code so that checkpoints truncate the xlog at the previous
- 1173344e74f7 7.2.1 cited