Hi, On 2020-01-12 16:18:38 +0500, Andrey Borodin wrote: > > 11 янв. 2020 г., в 7:34, Bruce Momjian <br...@momjian.us> написал(а): > > > > Actually, it might be worse than that. In my reading of > > RecordTransactionCommit(), we do this: > > > > write to WAL > > flush WAL (durable) > > make visible to other backends > > replicate > > communicate to the client > > > > I think this means we make the transaction commit visible to all > > backends _before_ we replicate it, and potentially wait until we get a > > replication reply to return SUCCESS to the client. > No. Data is not visible to other backend when we await sync rep.
Yea, as the relevant comment in RecordTransactionCommit() says; * Note that at this stage we have marked clog, but still show as running * in the procarray and continue to hold locks. */ if (wrote_xlog && markXidCommitted) SyncRepWaitForLSN(XactLastRecEnd, true); But it's worthwhile to emphasize that data at that stage actually *can* be visible on standbys. The fact that the transaction still shows as running via procarray, on the primary, does not influence visibility determinations on the standby. Greetings, Andres Freund