Re: User-facing aspects of serializable transactions

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: User-facing aspects of serializable transactions
Дата
Msg-id 4A1EE22E.EE98.0025.1@wicourts.gov
обсуждение исходный текст
Ответ на Re: User-facing aspects of serializable transactions  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Список pgsql-hackers
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> wrote: 
> so as you haven't read other
> data, you would be safe in the particular case you cite.
Sorry, that's not true.  If you run your bulk data load at
serializable isolation level, you could still get rolled back in this
scenario, even if you're just writing:
(1)  A concurrent serializable transaction reads data from a table
into which your bulk load will subsequently insert, without there yet
being a conflict between that read and your bulk inserts.  It also
modifies data somewhere.  It commits.
(2)  A serializable transaction concurrent with that mentioned in (1)
reads data which conflicts with the modification of (1).  It may also
commit.
(3)  Your bulk data load eventually (after the commit of (1)) inserts
data which conflicts with the read from (1).  (1) is no longer
available for rollback.  Unless (2) is still active, and preferred for
termination based on the bias chosen, your bulk load will be rolled
back.
That would suck.
There are several protections available, like taking an explicit lock
to protect the process, running at a less rigorous transaction
isolation level, etc., but it could happen.
-Kevin


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

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: pg_migrator and an 8.3-compatible tsvector data type
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: pg_migrator and an 8.3-compatible tsvector data type