summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Riggs2017-12-29 14:30:33 +0000
committerSimon Riggs2017-12-29 14:30:33 +0000
commit48c9f4926562278a2fd2b85e7486c6d11705f177 (patch)
tree192626a7b934aef6c19d9521c6845745ad9eb8e5
parent2958a672b1fed35403b23c2b453aede9f7ef4b39 (diff)
Fix race condition when changing synchronous_standby_names
A momentary window exists when synchronous_standby_names changes that allows commands issued after the change to continue to act as async until the change becomes visible. Remove the race by using more appropriate test in syncrep.c Author: Asim Rama Praveen and Ashwin Agrawal Reported-by: Xin Zhang, Ashwin Agrawal, and Asim Rama Praveen Reviewed-by: Michael Paquier, Masahiko Sawada
-rw-r--r--src/backend/replication/syncrep.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/backend/replication/syncrep.c b/src/backend/replication/syncrep.c
index 8677235411..962772ef8f 100644
--- a/src/backend/replication/syncrep.c
+++ b/src/backend/replication/syncrep.c
@@ -156,11 +156,9 @@ SyncRepWaitForLSN(XLogRecPtr lsn, bool commit)
mode = Min(SyncRepWaitMode, SYNC_REP_WAIT_FLUSH);
/*
- * Fast exit if user has not requested sync replication, or there are no
- * sync replication standby names defined. Note that those standbys don't
- * need to be connected.
+ * Fast exit if user has not requested sync replication.
*/
- if (!SyncRepRequested() || !SyncStandbysDefined())
+ if (!SyncRepRequested())
return;
Assert(SHMQueueIsDetached(&(MyProc->syncRepLinks)));