[ 
https://issues.apache.org/jira/browse/HAWQ-1521?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16148589#comment-16148589
 ] 

Hubert Zhang edited comment on HAWQ-1521 at 8/31/17 7:48 AM:
-------------------------------------------------------------

HAWQ remove allocateGang to record gang information in the following variables.
{code}
static List *allocatedReaderGangsN = NIL;
static List *availableReaderGangsN = NIL;
static List *allocatedReaderGangs1 = NIL;
static List *availableReaderGangs1 = NIL;
static Gang *primaryWriterGang = NULL;
{code}
As a result, calling gangsExist will always return false.
But the cached gang information, to be more specific the cached QE information 
could be found in other places at QD side. 
The following struct ExecutorCache(the two pools) contains the all the cached 
QE by a session. We could use this data structure to quit idle QE when session 
is idled for a long time.
{code}
typedef struct ExecutorCache {
        bool                            init;
        MemoryContext           ctx;
        struct PoolMgrState     *pool;
        struct PoolMgrState *entrydb_pool; // pool for entry db connection
        int             cached_num;
        int             allocated_num;
        int             takeover_num;
} ExecutorCache;

static ExecutorCache    executor_cache;
{code}


was (Author: hubertzhang):
HAWQ remove allocateGang to record gang information in the following variables.
static List *allocatedReaderGangsN = NIL;
static List *availableReaderGangsN = NIL;
static List *allocatedReaderGangs1 = NIL;
static List *availableReaderGangs1 = NIL;
static Gang *primaryWriterGang = NULL;
As a result, calling gangsExist will always return false.
But the cached gang information, to be more specific the cached QE information 
could be found in other places at QD side. 
The following struct ExecutorCache(the two pools) contains the all the cached 
QE by a session. We could use this data structure to quit idle QE when session 
is idled for a long time.
typedef struct ExecutorCache {
        bool                            init;
        MemoryContext           ctx;
        struct PoolMgrState     *pool;
        struct PoolMgrState *entrydb_pool; // pool for entry db connection
        int             cached_num;
        int             allocated_num;
        int             takeover_num;
} ExecutorCache;

static ExecutorCache    executor_cache;

> Idle QE Processes Can't Quit After An Interval
> ----------------------------------------------
>
>                 Key: HAWQ-1521
>                 URL: https://issues.apache.org/jira/browse/HAWQ-1521
>             Project: Apache HAWQ
>          Issue Type: Bug
>            Reporter: Lin Wen
>            Assignee: Radar Lei
>
> After a query is finished, there are some idle QE processes on segments. 
> These QE processes are expected to quit after a time interval, this interval 
> is controlled by a GUC gp_vmem_idle_resource_timeout, the default value is 18 
> seconds.
> However, this does't act as expected. Idle QE processes on segments always 
> exist there, unless the QD process quit. 
> The reason is in postgres.c, the codes to enable this timer can't get 
> executed. function gangsExist() always return false, since gang related 
> structures are all NULL.
>       if (IdleSessionGangTimeout > 0 && gangsExist())
>               if (!enable_sig_alarm( IdleSessionGangTimeout /* ms */, false))
>                       elog(FATAL, "could not set timer for client wait 
> timeout");



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to