syncreplock.patch

text/plain

Filename: syncreplock.patch
Type: text/plain
Part: 0
Message: Re: SyncRepLock acquired exclusively in default configuration

Patch

Format: unified
File+
src/backend/replication/syncrep.c 4 2
diff --git a/src/backend/replication/syncrep.c b/src/backend/replication/syncrep.c
index ffd5b31eb2..c6df3f4da6 100644
--- a/src/backend/replication/syncrep.c
+++ b/src/backend/replication/syncrep.c
@@ -163,9 +163,11 @@ SyncRepWaitForLSN(XLogRecPtr lsn, bool commit)
 		mode = Min(SyncRepWaitMode, SYNC_REP_WAIT_FLUSH);
 
 	/*
-	 * Fast exit if user has not requested sync replication.
+	 * Fast exit if user has not requested sync replication, or there are no
+	 * sync replication standby names defined.
 	 */
-	if (!SyncRepRequested())
+	if (!SyncRepRequested() ||
+		!((volatile WalSndCtlData *) WalSndCtl)->sync_standbys_defined)
 		return;
 
 	Assert(SHMQueueIsDetached(&(MyProc->syncRepLinks)));