Re: cache lookup failed for index

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: cache lookup failed for index
Дата
Msg-id 6841.1467210411@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: cache lookup failed for index  (Willy-Bas Loos <willybas@gmail.com>)
Ответы Re: cache lookup failed for index  (Willy-Bas Loos <willybas@gmail.com>)
Список pgsql-general
Willy-Bas Loos <willybas@gmail.com> writes:
> So what i don't get is, -if the above is the case- If  pg_dump expects to
> find an index, it already knows about its existence. Then why does it need
> to look for it again?

Because what it does is:

BEGIN ISOLATION LEVEL REPEATABLE READ;  -- run in a single transaction
SELECT ... FROM pg_class;  -- find out what all the tables are
LOCK TABLE foo IN ACCESS SHARE MODE;  -- repeat for each table to be dumped

after which it runs around and collects subsidiary data such as what
indexes exist for each table.  But the transaction's view of the catalogs
was frozen at the start of the first SELECT.  So it can see entries for
an index in pg_class and pg_index even if that index got dropped between
transaction start and where pg_dump was able to lock the index's table.
pg_dump can't tell the index is no longer there --- but some of the
backend functions it calls can tell, and they throw errors.

There are various ways this might be rejiggered, but none of them
entirely remove all risk of failure in the presence of concurrent DDL.
Personally I'd recommend just retrying the pg_dump until it succeeds.

            regards, tom lane


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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Enquiry
Следующее
От: Kaixi Luo
Дата:
Сообщение: How safe is pg_basebackup + continuous archiving?