diff --git a/src/gausskernel/process/postmaster/postmaster.cpp b/src/gausskernel/process/postmaster/postmaster.cpp index bcfbafe8518b9f88270e4a2ebf193f19c20fdfce..e255b0c216919152fcc7da5d50ff1292a2348f73 100644 --- a/src/gausskernel/process/postmaster/postmaster.cpp +++ b/src/gausskernel/process/postmaster/postmaster.cpp @@ -3281,6 +3281,7 @@ int ProcessStartupPacket(Port* port, bool SSLdone) struct timeval oldTv = {0, 0}; socklen_t oldTvLen = sizeof(oldTv); bool isTvSeted = false; + char portstr[MAX_UNIX_PATH_LEN] = {'\0'}; CHECK_FOR_PROCDIEPENDING(); @@ -3506,11 +3507,21 @@ 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"))); - } + if (g_instance.attr.attr_common.enable_thread_pool) { + if (AF_UNIX == port->laddr.addr.ss_family) { + UNIXSOCK_PATH(portstr, g_instance.attr.attr_network.PostPortNumber, g_instance.attr.attr_network.UnixSocketDir); + if (0 == (strncmp(port->laddr.addr.__ss_padding, portstr, MAX_UNIX_PATH_LEN))) { + ereport(elevel, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("replication should connect HA port in thread_pool"))); + } + } else if(IsLocalPort(u_sess->proc_cxt.MyProcPort)) { + 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 @@ -12281,3 +12292,4 @@ void InitShmemForDcfCallBack() } #endif +