Skip to content

Commit 9b8ed0f

Browse files
committed
Another fix to relmapper race condition.
In previous commit, I missed that relmap_redo() was also not acquiring the RelationMappingLock. Thanks to Thomas Munro for pointing that out. Backpatch-through: 9.6, like previous commit. Discussion: https://www.postgresql.org/message-id/CA%2BhUKGLev%3DPpOSaL3WRZgOvgk217et%2BbxeJcRr4eR-NttP1F6Q%40mail.gmail.com
1 parent b6d8d20 commit 9b8ed0f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/backend/utils/cache/relmapper.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,12 +1030,13 @@ relmap_redo(XLogReaderState *record)
10301030
* preserve files, either.
10311031
*
10321032
* There shouldn't be anyone else updating relmaps during WAL replay,
1033-
* so we don't bother to take the RelationMappingLock. We would need
1034-
* to do so if load_relmap_file needed to interlock against writers.
1033+
* but grab the lock to interlock against load_relmap_file().
10351034
*/
1035+
LWLockAcquire(RelationMappingLock, LW_EXCLUSIVE);
10361036
write_relmap_file((xlrec->dbid == InvalidOid), &newmap,
10371037
false, true, false,
10381038
xlrec->dbid, xlrec->tsid, dbpath);
1039+
LWLockRelease(RelationMappingLock);
10391040

10401041
pfree(dbpath);
10411042
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy