Re: invisible commit question for sync replication - Mailing list pgsql-general

From Laurenz Albe
Subject Re: invisible commit question for sync replication
Date
Msg-id 49ef95ee06cb0d94af198cac331f7bc39d743619.camel@cybertec.at
Whole thread Raw
In response to invisible commit question for sync replication  (qihua wu <staywithpin@gmail.com>)
Responses Re: invisible commit question for sync replication  (qihua wu <staywithpin@gmail.com>)
List pgsql-general
On Wed, 2023-02-01 at 14:52 +0800, qihua wu wrote:
> When run a cluster with sync replication, if DML is done on primary, but primary is
> isolated from all slave, then the DML will hang, if cancel it DML, it will say:
> WARNING:  canceling wait for synchronous replication due to user request
> DETAIL:  The transaction has already committed locally, but might not have been replicated to the standby
>
> So the workflow is
> 1: commit to local.
> 2: waiting for ACK from remote sync.
>
> When cancel the DML at step 2. the data are arealy on local, that's why it's warning.
>
> But when runs an insert which is waiting for remote ACK, and then query from another
> session, I didn't find that row. Why this happen? If the insert is already one locally,
> whey another session can't read it?

COMMIT is not as atomic as it appears.  When the backend is waiting for the standby,
it has already committed the transaction on disk, but that fact is not advertised to
the other backends yet.

Yours,
Laurenz Albe



pgsql-general by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: How could I elog the tupleTableSlot to the fronted terminal?
Next
From: qihua wu
Date:
Subject: Re: invisible commit question for sync replication