pgsql: Avoid potential deadlock in InitCatCachePhase2().

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Avoid potential deadlock in InitCatCachePhase2().
Дата
Msg-id E1Q24xd-0001bW-T0@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Avoid potential deadlock in InitCatCachePhase2().

Opening a catcache's index could require reading from that cache's own
catalog, which of course would acquire AccessShareLock on the catalog.
So the original coding here risks locking index before heap, which could
deadlock against another backend trying to get exclusive locks in the
normal order.  Because InitCatCachePhase2 is only called when a backend
has to start up without a relcache init file, the deadlock was seldom seen
in the field.  (And by the same token, there's no need to worry about any
performance disadvantage; so not much point in trying to distinguish
exactly which catalogs have the risk.)

Bug report, diagnosis, and patch by Nikhil Sontakke.  Additional commentary
by me.  Back-patch to all supported branches.

Branch
------
REL9_0_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/3cb2f2ae4cc481dc22682d364e7a93ba6f7f4baf

Modified Files
--------------
src/backend/utils/cache/catcache.c |    9 +++++++++
src/backend/utils/cache/relcache.c |   10 ++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)


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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: pgsql: Update docs to say you need fsync to make sync rep work fast.
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Avoid potential deadlock in InitCatCachePhase2().