Re: [HACKERS] [BUGS] Concurrent ALTER SEQUENCE RESTART Regression

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: [HACKERS] [BUGS] Concurrent ALTER SEQUENCE RESTART Regression
Дата
Msg-id 10d030f9-a494-f9e4-bec0-117acce994ef@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: [HACKERS] [BUGS] Concurrent ALTER SEQUENCE RESTART Regression  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 5/11/17 23:59, Tom Lane wrote:
> Right, but the existing code is *designed* to hold the lock till end of
> top-level transaction, regardless of what happens in any subtransaction.
> My understanding of your complaint is that you do not think that's OK
> for any lock stronger than AccessShareLock.

What he is saying (I believe) is: Because of that custom logic to hold
the lock until the end of the transaction across subtransactions, you
will keep holding the lock even if a subtransaction aborts, which is
nonstandard behavior.  Previously, nobody cared, because nobody else was
locking sequences.  But now we're proposing to make ALTER SEQUENCE lock
the sequence, so this behavior would be visible:

S1: BEGIN;
S1: SAVEPOINT s1;
S1: SELECT nextval('seq1');
S1: ROLLBACK TO SAVEPOINT s1;
S2: ALTER SEQUENCE seq1 MAXVALUE 100;  -- would now wait for S1 commit

My amendment to that is that "previously nobody cared" is not quite
correct, because the same already happens currently with DROP SEQUENCE.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Is there any way to access heap_open() from _PG_init ??
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: [HACKERS] WITH clause in CREATE STATISTICS