> On Sep 10, 2021, at 8:42 AM, Mark Dilger <mark.dil...@enterprisedb.com> wrote:
>
> Take for example a code stanza from heapam.c:
>
> if (needwal)
> CheckWALPermitted();
>
> /* NO EREPORT(ERROR) from here till changes are logged */
> START_CRIT_SECTION();
>
> Now, I know that interrupts won't be processed after starting the critical
> section, but I can see plain as day that an interrupt might get processed
> *during* CheckWALPermitted, since that function isn't atomic.
A better example may be found in ginmetapage.c:
needwal = RelationNeedsWAL(indexrel);
if (needwal)
{
CheckWALPermitted();
computeLeafRecompressWALData(leaf);
}
/* Apply changes to page */
START_CRIT_SECTION();
Even if CheckWALPermitted is assumed to be close enough to atomic to not be a
problem (I don't agree), that argument can't be made here, as
computeLeafRecompressWALData is not trivial and signals could easily be
processed while it is running.
—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company