Make XLogRecGetBlockTag() throw error if there's no such block.
All but a few existing callers assume without checking that this
function succeeds. While it probably will, that's a poor excuse for
not checking. Let's make it return void and instead throw an error
if it doesn't find the block reference. Callers that actually need
to handle the no-such-block case must now use the underlying function
XLogRecGetBlockTagExtended.
In addition to being a bit less error-prone, this should also serve
to suppress some Coverity complaints about XLogRecGetBlockRefInfo.
While at it, clean up some inconsistency about use of the
XLogRecHasBlockRef macro: make XLogRecGetBlockTagExtended use
that instead of open-coding the same condition, and avoid calling
XLogRecHasBlockRef twice in relevant code paths. (That is,
calling XLogRecHasBlockRef followed by XLogRecGetBlockTag is now
deprecated: use XLogRecGetBlockTagExtended instead.)
Patch HEAD only; this doesn't seem to have enough value to consider
a back-branch API break.
Discussion: https://postgr.es/m/425039.1649701221@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/bd037dc928dd126e5623117b2fe7633ec3fa7c40
Modified Files
--------------
src/backend/access/heap/heapam.c | 2 +-
src/backend/access/nbtree/nbtxlog.c | 2 +-
src/backend/access/rmgrdesc/xlogdesc.c | 11 +++++------
src/backend/access/transam/xlogreader.c | 24 ++++++++++++++++++------
src/backend/access/transam/xlogrecovery.c | 7 ++++---
src/backend/access/transam/xlogutils.c | 3 ++-
src/bin/pg_rewind/parsexlog.c | 3 ++-
src/bin/pg_waldump/pg_waldump.c | 5 ++---
src/include/access/xlogreader.h | 2 +-
9 files changed, 36 insertions(+), 23 deletions(-)