修复 使用replication协议连接监听端口后,数据库stop失败的问题

openGauss中,replication协议不能用线程池的线程。
如果数据库启用了线程池,并且出现用户操作失误使用了replication协议工具连接监听端口,连接失败后造成工作线程直接退出,引起gs_ctl stop停库失败。

现在直接在连接数据库时限制如果线程池模式下,replication工具只能通过HA端口连接数据库。
This commit is contained in:
Hemny
2021-06-18 09:43:34 +08:00
committed by Gitee
parent 68cb4eb003
commit 29c5bb6f7c

View File

@ -3238,6 +3238,12 @@ int ProcessStartupPacket(Port* port, bool SSLdone)
#endif
}
} else if (strcmp(nameptr, "replication") == 0) {
if (!IsHAPort(u_sess->proc_cxt.MyProcPort) && g_instance.attr.attr_common.enable_thread_pool) {
ereport(elevel,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("replication should connect HA port in thread_pool")));
}
/*
* Due to backward compatibility concerns the replication
* parameter is a hybrid beast which allows the value to be
@ -3253,11 +3259,6 @@ int ProcessStartupPacket(Port* port, bool SSLdone)
if (!g_instance.attr.attr_storage.enable_mix_replication)
t_thrd.datasender_cxt.am_datasender = true;
} else if (strcmp(valptr, "database") == 0) {
if (!IsHAPort(u_sess->proc_cxt.MyProcPort) && g_instance.attr.attr_common.enable_thread_pool) {
ereport(elevel,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("logical replication should connect HA port in thread_pool")));
}
t_thrd.role = WAL_DB_SENDER;
} else {
bool _am_normal_walsender = false;