Re: Fixing code that ignores failure of XLogRecGetBlockTag - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Fixing code that ignores failure of XLogRecGetBlockTag
Date
Msg-id CA+TgmoaOdNdd3fBsM0U=OqDrxJZST3z0ayA4dqVVKhXVoZ0vQQ@mail.gmail.com
Whole thread Raw
In response to Fixing code that ignores failure of XLogRecGetBlockTag  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Fixing code that ignores failure of XLogRecGetBlockTag
List pgsql-hackers
On Mon, Apr 11, 2022 at 2:20 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 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().

Looks reasonable.

-- 
Robert Haas
EDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: make MaxBackends available in _PG_init
Next
From: Nathan Bossart
Date:
Subject: Re: make MaxBackends available in _PG_init