git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 1bb6924) | patch
Fix race condition in relcache init file invalidation.
2011年8月16日 17:11:54 +0000 (13:11 -0400)
2011年8月16日 17:11:54 +0000 (13:11 -0400)
commit 2ada6779c5d3fcc31568ba263f8a0cc9bb8318c1
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.
src/backend/access/transam/twophase.c diff | blob | blame | history
src/backend/utils/cache/inval.c diff | blob | blame | history
src/backend/utils/cache/relcache.c diff | blob | blame | history
src/include/utils/relcache.h diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /