postgres/src/backend
Peter Geoghegan 1a990b207b Have BufFileSize() ereport() on FileSize() failure.
Move the responsibility for checking for and reporting a failure from
the only current BufFileSize() caller, logtape.c, to BufFileSize()
itself.  Code within buffile.c is generally responsible for interfacing
with fd.c to report irrecoverable failures.  This seems like a
convention that's worth sticking to.

Reorganizing things this way makes it easy to make the error message
raised in the event of BufFileSize() failure descriptive of the
underlying problem.  We're now clear on the distinction between
temporary file name and BufFile name, and can show errno, confident that
its value actually relates to the error being reported.  In passing, an
existing, similar buffile.c ereport() + errcode_for_file_access() site
is changed to follow the same conventions.

The API of the function BufFileSize() is changed by this commit, despite
already being in a stable release (Postgres 11).  This seems acceptable,
since the BufFileSize() ABI was changed by commit aa55183042, which
hasn't made it into a point release yet.  Besides, it's difficult to
imagine a third party BufFileSize() caller not just raising an error
anyway, since BufFile state should be considered corrupt when
BufFileSize() fails.

Per complaint from Tom Lane.

Discussion: https://postgr.es/m/26974.1540826748@sss.pgh.pa.us
Backpatch: 11-, where shared BufFiles were introduced.
2018-11-28 14:42:54 -08:00
..
access Do not decode TOAST data for table rewrites 2018-11-28 01:43:08 +01:00
bootstrap Remove WITH OIDS support, change oid catalog column visibility. 2018-11-20 16:00:17 -08:00
catalog Remove WITH OIDS support, change oid catalog column visibility. 2018-11-20 16:00:17 -08:00
commands Integrate recovery.conf into postgresql.conf 2018-11-25 16:33:40 +01:00
executor Add WL_EXIT_ON_PM_DEATH pseudo-event. 2018-11-23 20:46:34 +13:00
foreign Remove WITH OIDS support, change oid catalog column visibility. 2018-11-20 16:00:17 -08:00
jit Fix jit compilation bug on wide tables. 2018-11-27 10:07:03 -08:00
lib Rename rbtree.c functions to use "rbt" prefix not "rb" prefix. 2018-11-06 13:25:24 -05:00
libpq Don't set PAM_RHOST for Unix sockets. 2018-11-28 14:12:30 +13:00
main Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodes Revise attribute handling code on partition creation 2018-11-08 16:22:09 -03:00
optimizer Remove WITH OIDS support, change oid catalog column visibility. 2018-11-20 16:00:17 -08:00
parser Remove WITH OIDS support, change oid catalog column visibility. 2018-11-20 16:00:17 -08:00
partitioning Reduce unnecessary list construction in RelationBuildPartitionDesc. 2018-11-19 12:10:41 -05:00
po Translation updates 2018-06-25 12:37:18 +02:00
port Fix spelling errors and typos in comments 2018-11-02 13:56:52 +01:00
postmaster Silence compiler warnings 2018-11-23 13:01:05 -03:00
regex Clean up warnings from -Wimplicit-fallthrough. 2018-05-01 19:35:08 -04:00
replication Do not decode TOAST data for table rewrites 2018-11-28 01:43:08 +01:00
rewrite Remove WITH OIDS support, change oid catalog column visibility. 2018-11-20 16:00:17 -08:00
snowball Sync our Snowball stemmer dictionaries with current upstream. 2018-09-24 17:29:38 -04:00
statistics Remove WITH OIDS support, change oid catalog column visibility. 2018-11-20 16:00:17 -08:00
storage Have BufFileSize() ereport() on FileSize() failure. 2018-11-28 14:42:54 -08:00
tcop Remove WITH OIDS support, change oid catalog column visibility. 2018-11-20 16:00:17 -08:00
tsearch Remove WITH OIDS support, change oid catalog column visibility. 2018-11-20 16:00:17 -08:00
utils Have BufFileSize() ereport() on FileSize() failure. 2018-11-28 14:42:54 -08:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Integrate recovery.conf into postgresql.conf 2018-11-25 16:33:40 +01:00
nls.mk Translation updates 2018-06-25 12:37:18 +02:00