Repository: incubator-hawq
Updated Branches:
  refs/heads/master f77a332fb -> b3cf1a29f


HAWQ-1347. QD should check segment health only


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/b3cf1a29
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/b3cf1a29
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/b3cf1a29

Branch: refs/heads/master
Commit: b3cf1a29f7f97cd81f3c7f741a3f11c0b7f68d71
Parents: f77a332
Author: Paul Guo <[email protected]>
Authored: Tue Feb 21 18:06:44 2017 +0800
Committer: Paul Guo <[email protected]>
Committed: Wed Feb 22 10:33:27 2017 +0800

----------------------------------------------------------------------
 src/backend/cdb/dispatcher_mgt.c |  2 +-
 src/backend/cdb/executormgr.c    | 14 ++++++++++----
 src/include/cdb/executormgr.h    |  2 +-
 3 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/b3cf1a29/src/backend/cdb/dispatcher_mgt.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/dispatcher_mgt.c b/src/backend/cdb/dispatcher_mgt.c
index 5b1622d..fa4efdb 100644
--- a/src/backend/cdb/dispatcher_mgt.c
+++ b/src/backend/cdb/dispatcher_mgt.c
@@ -326,7 +326,7 @@ dispmgt_thread_func_run(QueryExecutorGroup *group, struct 
WorkerMgrState *state)
                        {
                                write_log("%s(): detected one segment (Global 
ID: %d) is down, "
                                                  "so abort the query that is 
running or will run on it",
-                                                 __func__, 
executormgr_get_ID(executor));
+                                                 __func__, 
executormgr_get_segment_ID(executor));
                                err_handle_executor = executor;
                                goto error_cleanup;
                        }

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/b3cf1a29/src/backend/cdb/executormgr.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/executormgr.c b/src/backend/cdb/executormgr.c
index 772af1a..5a1c15d 100644
--- a/src/backend/cdb/executormgr.c
+++ b/src/backend/cdb/executormgr.c
@@ -322,9 +322,15 @@ executormgr_get_executor_result(QueryExecutor *executor)
 }
 
 int
-executormgr_get_ID(QueryExecutor *executor)
+executormgr_get_segment_ID(QueryExecutor *executor)
 {
-       return executor->desc->segment->ID;
+       Segment *seg = executor->desc->segment;
+
+       /* For segment only */
+       if (seg->master || seg->standby)
+               return -1;
+
+       return seg->ID;
 }
 
 int
@@ -485,9 +491,9 @@ executormgr_check_segment_status(QueryExecutor *executor)
         * until timeout when one segment is down. This will cause QD keep 
polling
         * until QE timeout.
         */
-       int ID = executormgr_get_ID(executor);
+       int ID = executormgr_get_segment_ID(executor);
 
-       if (IsSegmentDown(ID))
+       if (ID >= 0 && IsSegmentDown(ID))
        {
                cdbdisp_seterrcode(ERRCODE_GP_INTERCONNECTION_ERROR, -1,
                                                   
executormgr_get_executor_result(executor));

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/b3cf1a29/src/include/cdb/executormgr.h
----------------------------------------------------------------------
diff --git a/src/include/cdb/executormgr.h b/src/include/cdb/executormgr.h
index dfc230f..31d44fa 100644
--- a/src/include/cdb/executormgr.h
+++ b/src/include/cdb/executormgr.h
@@ -70,7 +70,7 @@ extern void executormgr_get_executor_connection_info(struct 
QueryExecutor *execu
 extern bool    executormgr_is_stop(struct QueryExecutor *executor);
 extern bool    executormgr_has_error(struct QueryExecutor *executor);
 extern int     executormgr_get_executor_slice_id(struct QueryExecutor 
*executor);
-extern int     executormgr_get_ID(struct QueryExecutor *executor);
+extern int     executormgr_get_segment_ID(struct QueryExecutor *executor);
 extern int     executormgr_get_fd(struct QueryExecutor *executor);
 extern bool    executormgr_cancel(struct QueryExecutor * executor);
 extern bool    executormgr_dispatch_and_run(struct DispatchData *data, struct 
QueryExecutor *executor);

Reply via email to