Re: Cascade replication

Fujii Masao <masao.fujii@gmail.com>

From: Fujii Masao <masao.fujii@gmail.com>
To: Simon Riggs <simon@2ndquadrant.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2011-07-19T11:19:40Z
Lists: pgsql-hackers
On Tue, Jul 19, 2011 at 5:58 PM, Simon Riggs <simon@2ndquadrant.com> wrote:
> On Mon, Jul 11, 2011 at 7:28 AM, Fujii Masao <masao.fujii@gmail.com> wrote:
>
>> Attached is the updated version which addresses all the issues raised by
>> Simon.
>
> Is there any reason why we disallow cascading unless hot standby is enabled?
>
> ISTM we can just alter the postmaster path for walsenders, patch attached.
>
> Some people might be happier if a sync standby were not HS enabled,
> yet able to cascade to other standbys for reading.

-			return CAC_STARTUP; /* normal startup */
+			{
+				if (am_walsender)
+					return CAC_OK;
+				else
+					return CAC_STARTUP; /* normal startup */
+			}

In canAcceptConnections(), am_walsender is always false, so the above CAC_OK
is never returned. You should change ProcessStartupPacket() as follows, instead.

	switch (port->canAcceptConnections)
 	{
 		case CAC_STARTUP:
+			if (am_walsender)
+			{
+				port->canAcceptConnections = CAC_OK;
+				break;
+			}
 			ereport(FATAL,

When I fixed the above, compile the code and set up the cascading replication
environment (disable hot_standby), I got the following assertion error:

    TRAP: FailedAssertion("!(slot > 0 && slot <=
PMSignalState->num_child_flags)", File: "pmsignal.c", Line: 227)

So we would still have some code to change.

Regards,

-- 
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center