Transactions over pathological TCP connections

Поиск
Список
Период
Сортировка
От Leon Smith
Тема Transactions over pathological TCP connections
Дата
Msg-id CAPwAf1ksnfps0z=3VwsCojwX4ui-V1-u-u-TA9UH_7xgAvvFAw@mail.gmail.com
обсуждение исходный текст
Ответы Re: Transactions over pathological TCP connections  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Out of (mostly idle) curiousity,  when exactly does a transaction commit, especially with respect to a TCP connection that a pathological demon will cut off at the worst possible moment?

The thing is,  I'm using PostgreSQL as a queue,  using asynchronous notifications and following the advice of Marko Tiikkaja in this post:


I'm using a stored procedure to reduce the round trips between the database and client,  and then running it in a "bare transaction",  that is,  as "SELECT dequeue_element();"  with an implicit BEGIN/COMMIT to mark a row in the queue as taken and return it.  

My question is,  would it be theoretically possible for an element of a queue to become marked but not delivered,  or delivered and not marked,  if the TCP connection between the backend and client was interrupted at the worst possible moment?   Will the backend wait for the delivery of the row be acknowledged before the transaction is committed?     Or should the truly paranoid use an explicit transaction block and not consider the row taken until confirmation that the transaction has committed has been received?

Best,
Leon

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

Предыдущее
От: Jeff Davis
Дата:
Сообщение: Re: initdb and fsync
Следующее
От: Andres Freund
Дата:
Сообщение: Re: initdb and fsync