From ce360ef7efc528160f5dc6acf001e63c4f0da948 Mon Sep 17 00:00:00 2001 From: hemny Date: Thu, 28 Oct 2021 22:05:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DBug:=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E7=BA=BF=E7=A8=8B=E6=B1=A0=E5=90=8E=E5=A4=87=E6=9C=BA=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E4=B8=BB=E6=9C=BA=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../process/postmaster/postmaster.cpp | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/gausskernel/process/postmaster/postmaster.cpp b/src/gausskernel/process/postmaster/postmaster.cpp index bcfbafe851..e255b0c216 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 + -- Gitee