forbid hotstandby on standby cluster

This commit is contained in:
shirley_zhengx
2024-03-14 20:16:56 +08:00
parent 98544ec6c2
commit ea818a302f

View File

@ -5192,8 +5192,10 @@ int ProcessStartupPacket(Port* port, bool SSLdone)
ereport(ERROR,
(errcode(ERRCODE_CANNOT_CONNECT_NOW), errmsg("can not accept connection in standby mode.")));
}
#else
if (hashmdata->current_mode == STANDBY_MODE && !g_instance.attr.attr_storage.EnableHotStandby) {
#else
/* All node in SS_DISASTER_STANDBY_CLUSTER can not accept connection when hot_standby=off */
if (((hashmdata->current_mode == STANDBY_MODE || SS_DISASTER_STANDBY_CLUSTER)
&& !g_instance.attr.attr_storage.EnableHotStandby)) {
ereport(elevel, (errcode(ERRCODE_CANNOT_CONNECT_NOW),
errmsg("can not accept connection if hot standby off")));
}