BUG #16498: The master inserts data successfully when the standby stopped in synchronous stream replication

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: abcxiaod(at)126(dot)com
Subject: BUG #16498: The master inserts data successfully when the standby stopped in synchronous stream replication
Date: 2020-06-18 03:20:03
Message-ID: 16498-4e2fce82c5d90d9c@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 16498
Logged by: yi Ding
Email address: abcxiaod(at)126(dot)com
PostgreSQL version: 10.12
Operating system: linux
Description:

Master PGserver:
1、Table test_1 currently has no data
postgres=# select * from test_1;
 a
---
(0 rows)

2、Synchronous streaming replication
postgres=# show synchronous_standby_names ;
 synchronous_standby_names
---------------------------
 sb2019abcd514
(1 row)

3、Stop the standby PGserver

4、Insert data

postgres=# begin;
BEGIN
postgres=# insert into test_1 values(2);
INSERT 0 1
postgres=# insert into test_1 values(3);
INSERT 0 1
postgres=# commit;

commit stuck

5、Restart the database

6、Check table test_1, data is still committed

postgres=# select * from test_1;
 a
---
2
3
(0 rows)

7、Code structure
CommitTransaction->RecordTransactionCommit::
if ((wrote_xlog && markXidCommitted && synchronous_commit >
SYNCHRONOUS_COMMIT_OFF) || forceSyncCommit || nrels > 0){
XLogFlush(XactLastRecEnd);
/*
* Now we may update the CLOG, if we wrote a COMMIT record above
*/
if (markXidCommitted)
TransactionIdCommitTree(xid, nchildren, children);
}else{
XLogSetAsyncXactLSN(XactLastRecEnd);
if (markXidCommitted)
TransactionIdAsyncCommitTree(xid, nchildren, children,
XactLastRecEnd);
}
...
if (wrote_xlog && markXidCommitted)
SyncRepWaitForLSN(XactLastRecEnd, true);
if (!SyncRepRequested())
return;
for(;;){

}
...
#define SyncRepRequested() \
(max_wal_senders > 0 && synchronous_commit >
SYNCHRONOUS_COMMIT_LOCAL_FLUSH)

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2020-06-18 06:31:08 BUG #16499: Escape Characters in FTS
Previous Message PG Bug reporting form 2020-06-17 21:00:23 BUG #16497: old and new pg_controldata WAL segment sizes are invalid or do not match