allow_cascading_without_hot_standby.v1.patch

application/octet-stream

Filename: allow_cascading_without_hot_standby.v1.patch
Type: application/octet-stream
Part: 0
Message: Re: Cascade replication
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 412bc96..3b40e38 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -1853,7 +1853,12 @@ canAcceptConnections(void)
 		else if (!FatalError &&
 				 (pmState == PM_STARTUP ||
 				  pmState == PM_RECOVERY))
-			return CAC_STARTUP; /* normal startup */
+			{
+				if (am_walsender)
+					return CAC_OK;
+				else
+					return CAC_STARTUP; /* normal startup */
+			}
 		else if (!FatalError &&
 				 pmState == PM_HOT_STANDBY)
 			result = CAC_OK;	/* connection OK during hot standby */
diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h
index cdbf63f..9a12e9b 100644
--- a/src/include/access/xlog.h
+++ b/src/include/access/xlog.h
@@ -222,7 +222,7 @@ extern int	wal_level;
 #define XLogStandbyInfoActive() (wal_level >= WAL_LEVEL_HOT_STANDBY)
 
 /* Can we allow the standby to accept replication connection from another standby? */
-#define AllowCascadeReplication() (EnableHotStandby && max_wal_senders > 0)
+#define AllowCascadeReplication() (max_wal_senders > 0)
 
 #ifdef WAL_DEBUG
 extern bool XLOG_DEBUG;