Fixing code that ignores failure of XLogRecGetBlockTag

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Fixing code that ignores failure of XLogRecGetBlockTag
Date: 2022-04-11 18:20:21
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Currently, XLogRecGetBlockTag has 41 callers, of which only four
bother to check the function's result. The remainder take it on
faith that they got valid data back, and many of them will
misbehave in seriously nasty ways if they didn't. (This point
was drawn to my attention by a Coverity complaint.)

I think we should make this a little less fragile. Since we
already have XLogRecGetBlockTagExtended, I propose that callers
that need to handle the case of no-such-block must use that,
while XLogRecGetBlockTag throws an error. The attached patch
fixes that up, and also cleans up some random inconsistency
about use of XLogRecHasBlockRef().

regards, tom lane

Attachment Content-Type Size
make-XLogRecGetBlockTag-throw-error.patch text/x-diff 7.1 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2022-04-11 18:37:07 Re: [Proposal] vacuumdb --schema only
Previous Message Robert Haas 2022-04-11 18:00:34 Re: API stability