This is an automated email from the ASF dual-hosted git repository.

ztao1987 pushed a commit to branch ztao
in repository https://gitbox.apache.org/repos/asf/hawq.git

commit 3636513fb67db810894d859c4cdda6c6f2a70fc2
Author: ztao1987 <[email protected]>
AuthorDate: Thu Dec 9 14:23:09 2021 +0800

    HAWQ-1820. avoid of qe termination by proxy dispatcher
---
 src/backend/cdb/cdbvars.c   | 1 +
 src/backend/tcop/postgres.c | 3 ++-
 src/include/cdb/cdbvars.h   | 2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/backend/cdb/cdbvars.c b/src/backend/cdb/cdbvars.c
index 0225d34..219743a 100644
--- a/src/backend/cdb/cdbvars.c
+++ b/src/backend/cdb/cdbvars.c
@@ -54,6 +54,7 @@
 GpRoleValue Gp_role;                   /* Role paid by this Greenplum Database 
backend */
 char      *gp_role_string;     /* Staging area for guc.c */
 bool           gp_set_read_only;       /* Staging area for guc.c */
+bool        gp_is_proxy_dispatcher = false;
 bool        proxy_dispatcher_prepare_error = false;
 
 GpRoleValue Gp_session_role;   /* Role paid by this Greenplum Database backend 
*/
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index ba6c17a..cd48d60 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -4903,7 +4903,7 @@ PostgresMain(int argc, char *argv[], const char *username)
                /*
                 * (3) read a command (loop blocks here)
                 */
-               if (Gp_role == GP_ROLE_DISPATCH)
+               if (Gp_role == GP_ROLE_DISPATCH && !gp_is_proxy_dispatcher)
                {
                        /*
                         * We want to check to see if our session goes "idle" 
(nobody sending us work to do)
@@ -5504,6 +5504,7 @@ PostgresMain(int argc, char *argv[], const char *username)
                        case 'V':  /* HAWQ proxy dispatcher startup info*/
                        {
                          Gp_role = GP_ROLE_DISPATCH;  // I am proxy dispatcher
+                         gp_is_proxy_dispatcher = true;
                          PG_TRY();
                          {
                            set_ps_display("proxy dispatcher", false);
diff --git a/src/include/cdb/cdbvars.h b/src/include/cdb/cdbvars.h
index 5b58562..2b6bfdc 100644
--- a/src/include/cdb/cdbvars.h
+++ b/src/include/cdb/cdbvars.h
@@ -144,6 +144,8 @@ extern char *gp_role_string;        /* Use by guc.c as 
staging area for value. */
 extern const char *assign_gp_role(const char *newval, bool doit, GucSource 
source);
 extern const char *show_gp_role(void);
 
+extern bool gp_is_proxy_dispatcher;
+
 extern bool proxy_dispatcher_prepare_error;
 
 extern bool gp_reraise_signal; /* try to force a core dump ?*/

Reply via email to