diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-08-16 13:12:10 -0400 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-08-16 13:12:10 -0400 |
| commit | 93519b0c620123301142ac49b79796be20c2dce8 (patch) | |
| tree | c4a4b6cd8c042f1da988a906268ef15dc141760b /src/include | |
| parent | f239ec57277b3fffe1c5bd2694a9d0d726d3a259 (diff) | |
Fix race condition in relcache init file invalidation.
The previous code tried to synchronize by unlinking the init file twice,
but that doesn't actually work: it leaves a window wherein a third process
could read the already-stale init file but miss the SI messages that would
tell it the data is stale. The result would be bizarre failures in catalog
accesses, typically "could not read block 0 in file ..." later during
startup.
Instead, hold RelCacheInitLock across both the unlink and the sending of
the SI messages. This is more straightforward, and might even be a bit
faster since only one unlink call is needed.
This has been wrong since it was put in (in 2002!), so back-patch to all
supported releases.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/utils/relcache.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/include/utils/relcache.h b/src/include/utils/relcache.h index 4db4ba5db28..30c7a2acea3 100644 --- a/src/include/utils/relcache.h +++ b/src/include/utils/relcache.h @@ -96,7 +96,8 @@ extern void AtEOSubXact_RelationCache(bool isCommit, SubTransactionId mySubid, * Routines to help manage rebuilding of relcache init files */ extern bool RelationIdIsInInitFile(Oid relationId); -extern void RelationCacheInitFileInvalidate(bool beforeSend); +extern void RelationCacheInitFilePreInvalidate(void); +extern void RelationCacheInitFilePostInvalidate(void); extern void RelationCacheInitFileRemove(void); /* should be used only by relcache.c and catcache.c */ |
