Re: Confusions regards serializable transaction

Поиск
Список
Период
Сортировка
От Hannah Huang
Тема Re: Confusions regards serializable transaction
Дата
Msg-id 31DA4198-1B8E-4999-9A19-49AD87F36BDB@gmail.com
обсуждение исходный текст
Ответ на Re: Confusions regards serializable transaction  (Peter Geoghegan <pg@bowt.ie>)
Список pgsql-novice

> On 4 Sep 2020, at 2:21 pm, Peter Geoghegan <pg@bowt.ie> wrote:
>
> On Thu, Sep 3, 2020 at 5:20 PM Hannah Huang <hannah.huang.y@gmail.com> wrote:
>> I’m confused about what will trigger the serializable error. My test environment is PG v12.
>>
>> This is how you can produce the test table:
>
> Serializable isolation level promises to emulate serial transaction
> execution for all committed transactions. I believe that your example
> does not show behavior that breaks that specific promise.
>
> --
> Peter Geoghegan

Hi Peter,
Thank you very much for replying my question.

My confusion is actually:

Transaction B updated the n value of  id 2, while transaction A needs to update n value for id 1 referencing the n
valueof id 2. 

If the transaction is executed in a serialized way, then the n value of id 2 will be changed in transaction B first,
andthe change will be reflected in the value of id 1in transaction A. However, the two transactions are not executed
concurrently- transaction A executed successfully without seeing changes made in transaction B. Is that a break of
serializableisolation level? 

Thanks,
Hannah


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

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: Confusions regards serializable transaction
Следующее
От: JORGE MALDONADO
Дата:
Сообщение: Collation and Character Type