Re: Disallow cancellation of waiting for synchronous replication

From: Maksim Milyutin <milyutinma(at)gmail(dot)com>
To: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Cc: Marco Slot <marco(at)citusdata(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, dim(at)tapoueh(dot)org
Subject: Re: Disallow cancellation of waiting for synchronous replication
Date: 2019-12-26 13:14:40
Message-ID: 1e668591-e3b2-6422-b0c1-168a9d894981@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 25.12.2019 13:45, Andrey Borodin wrote:
>> 25 дек. 2019 г., в 15:28, Maksim Milyutin <milyutinma(at)gmail(dot)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 (though with 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 topic to 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 Content-Type Size
0001-Disallow-cancelation-of-syncronous-commit-V2.patch text/x-patch 3.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Anastasia Lubennikova 2019-12-26 13:26:34 Re: Building infrastructure for B-Tree deduplication that recognizes when opclass equality is also equivalence
Previous Message Julien Rouhaud 2019-12-26 12:11:53 Re: Expose lock group leader pid in pg_stat_activity