Re: Disallow cancellation of waiting for synchronous replication - Mailing list pgsql-hackers

From Maksim Milyutin
Subject Re: Disallow cancellation of waiting for synchronous replication
Date
Msg-id 1e668591-e3b2-6422-b0c1-168a9d894981@gmail.com
Whole thread Raw
In response to Re: Disallow cancellation of waiting for synchronous replication  (Andrey Borodin <x4mmm@yandex-team.ru>)
List pgsql-hackers
On 25.12.2019 13:45, Andrey Borodin wrote:
>> 25 дек. 2019 г., в 15:28, Maksim Milyutin <milyutinma@gmail.com> написал(а):
>>
>>> Synchronous replication
>>> does not guarantee that a committed write is actually on any replica,
>>> but it does in general guarantee that a commit has been replicated
>>> before sending a response to the client. That's arguably more
>>> important because the rest of what the application might depend on the
>>> transaction completing and replicating successfully. I don't know of
>>> cases other than cancellation in which a response is sent to the
>>> client without replication when synchronous replication is enabled.
>>
>> Yes, at query canceling (e.g. by timeout from client driver) client receives response about completed transaction
(thoughwith warning which not all client drivers can handle properly) and the guarantee about successfully replicated
transaction*violates*.
 
> We obviously need a design discussion here to address the issue. But the immediate question is should we add this
topicto January CF items?
 


+1 on posting this topic to January CF.

Andrey, some fixes from me:

1) pulled out the cancelling of QueryCancelPending from internal branch 
where synchronous_commit_cancelation is set so that to avoid dummy 
iterations with printing message "canceling the wait for ..."

2) rewrote errdetail message under cancelling query: I hold in this case 
we cannot assert that transaction committed locally because its changes 
are not visible as yet so I propose to write about locally flushed 
commit wal record.

Updated patch is attached.

-- 
Best regards,
Maksim Milyutin


Attachment

pgsql-hackers by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: Expose lock group leader pid in pg_stat_activity
Next
From: Anastasia Lubennikova
Date:
Subject: Re: Building infrastructure for B-Tree deduplication that recognizeswhen opclass equality is also equivalence