pgsql: Fix race condition in relcache init file invalidation.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix race condition in relcache init file invalidation.
Дата
Msg-id E1QtNCQ-0003F1-Bc@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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.

Branch
------
REL8_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/bcc9b17bbf92d1d94581d5536770b9689a767c37

Modified Files
--------------
src/backend/utils/cache/inval.c    |    8 ++--
src/backend/utils/cache/relcache.c |   68 +++++++++++++++++++----------------
src/include/utils/relcache.h       |    3 +-
3 files changed, 43 insertions(+), 36 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: cunha17@pgfoundry.org (User Cunha17)
Дата:
Сообщение: snapshot - src: FIX: Support for PostGIS datatypes Geometry and
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix race condition in relcache init file invalidation.