Re: Hard problem with concurrency

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Hard problem with concurrency
Дата
Msg-id 1350.1045450734@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Hard problem with concurrency  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
Список pgsql-hackers
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
> I can't try the insert and then the update because the INSERT, in Postgres,
> will cause an outright transaction failure.

Do the update, then try to insert if the update found nothing, and put
a retry loop around the whole transaction in case you fail because of
concurrent inserts.

Realistically you will need a retry loop in all but the most trivial
cases anyway --- certainly so if you want to use serializable
transaction mode.  So I don't think this solution is unworkably complex.
        regards, tom lane


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

Предыдущее
От: greg@turnstep.com
Дата:
Сообщение: Re: Hard problem with concurrency
Следующее
От: "Christopher Kings-Lynne"
Дата:
Сообщение: Re: Hard problem with concurrency