Re: pg_dump --snapshot

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: pg_dump --snapshot
Дата
Msg-id 20130507181424.GC14818@awork2.anarazel.de
обсуждение исходный текст
Ответ на Re: pg_dump --snapshot  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2013-05-06 13:07:17 -0400, Tom Lane wrote:
> I'm afraid that this is institutionalizing a design deficiency in
> pg_dump; namely that it takes its snapshot before acquiring locks.

I have suggested this before, but if pg_dump would use SELECT FOR SHARE
in the queries it uses to build DDL it would detect most if not all
modifications for most database objects including tables. Sure, it would
error out, but thats far better than a silently corrupt dump:

S1: =# CREATE TABLE testdump();
S2: =# BEGIN TRANSACTION ISOLATION LEVEL REPEATABLE READ;
S2: =# SELECT count(*) FROM pg_class; --acquire snapshot
S1: =# ALTER TABLE testdump ADD COLUMN a text;
S2: =#
-# SELECT * FROM pg_class cls
-#     JOIN pg_attribute att ON (cls.oid = att.attrelid)
-#     WHERE cls.oid = 'testdump'::regclass FOR UPDATE
ERROR: could not serialize access due to concurrent update

The serialization failure could be caught and translated into some error
message explaining that concurrent ddl prevented pg_dump from working
correctly. I don't immediately see a case where that would prevent valid
backups from working.

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Fix permission tests for views/tables proven empty by constraint
Следующее
От: Robert Haas
Дата:
Сообщение: Re: \watch stuck on execution of commands returning no tuples