RE: Table locking during backup

Поиск
Список
Период
Сортировка
От Artur Zając
Тема RE: Table locking during backup
Дата
Msg-id 02b701d57da3$57bea1f0$073be5d0$@ang.com.pl
обсуждение исходный текст
Ответ на Re: Table locking during backup  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Ответы Re: Table locking during backup
Список pgsql-general
> Not sure why would it matter that the pg_dump connection is read-only, this is about locking because
> pg_dump needs to ensure the schema does not change while it's running.
> pg_dump does not do
>
>   LOCK TABLE gm.tableabc;
>
> but
>
>   LOCK TABLE gm.tableabc IN ACCESS SHARE MODE;
>
> Which should be visible in pg_locks system view. And it does conflict with the ACCESS EXCLUSIVE mode, > used by the
secondquery. 

My mistake. I cited the log incorrectly - of course should be (and there was) LOCK TABLE gm.tableabc IN ACCESS SHARE
MODE. 
After all, your answer does not explain everything. I tried to reproduce the minimum commands:

First session:

BEGIN;
set transaction isolation level repeatable read, read only;
lock TABLE gm.tableabc IN access share mode;


Second session:
BEGIN;
CREATE TEMP TABLE IF NOT EXISTS tableabc (Id BIGINT DEFAULT random()) INHERITS (gm.tableabc);

"CREATE TEMP TABLE" does not wait for anything. Waiting state is only when I start third session with the same queries
asin second. 

Maybe "LOCK TABLE ... IN ACCESS SHARE MODE" is the answer, but with correlation with some other query or setting setted
bypg_backup. 

Table gm.tableabc is created with "create table gm.tableabc (x int default random());"

AZ




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

Предыдущее
От: Konstantin Izmailov
Дата:
Сообщение: Re: COPY command returns "ERROR: invalid XML content"
Следующее
От: "Arnaud L."
Дата:
Сообщение: Re: psql \copy hanging