pgsql: Fix parallel worker tracking of new catalog relfilenumbers. - Mailing list pgsql-committers

From Noah Misch
Subject pgsql: Fix parallel worker tracking of new catalog relfilenumbers.
Date
Msg-id E1t40ZW-002FiA-Sd@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix parallel worker tracking of new catalog relfilenumbers.

Reunite RestorePendingSyncs() with RestoreRelationMap().  If
RelationInitPhysicalAddr() ran after RestoreRelationMap() but before
RestorePendingSyncs(), the relcache entry could cause RelationNeedsWAL()
to return true erroneously.  Trouble required commands of the current
transaction to include REINDEX or CLUSTER of a system catalog.  The
parallel leader correctly derived RelationNeedsWAL()==false from the new
relfilenumber, but the worker saw RelationNeedsWAL()==true.  Worker
MarkBufferDirtyHint() then wrote unwanted WAL.  Recovery of that
unwanted WAL could lose tuples like the system could before commit
c6b92041d38512a4176ed76ad06f713d2e6c01a8 introduced this tracking.
RestorePendingSyncs() and RestoreRelationMap() were adjacent till commit
126ec0bc76d044d3a9eb86538b61242bf7da6db4, so no back-patch for now.

Reviewed by Tom Lane.

Discussion: https://postgr.es/m/20241019232815.c6.nmisch@google.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/67bab53d64428e4d43386be0e077cd662bc9cad3

Modified Files
--------------
src/backend/access/transam/parallel.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)


pgsql-committers by date:

Previous
From: Fujii Masao
Date:
Subject: pgsql: Refactor GetLockStatusData() to skip backends/groups without fas
Next
From: Tom Lane
Date:
Subject: pgsql: Generalize plpgsql's heuristic for importing expanded objects.