This is an automated email from the ASF dual-hosted git repository.
huor pushed a commit to branch taoz
in repository https://gitbox.apache.org/repos/asf/hawq.git
The following commit(s) were added to refs/heads/taoz by this push:
new e8c4cf3 Revert "enable cleaning up idle cached executors when guc
gp_vmem_idle_resource_timeout specificed timer expires"
e8c4cf3 is described below
commit e8c4cf3714959a71bb5eb427e63dbbd3d819568b
Author: Ruilong Huo <[email protected]>
AuthorDate: Mon Jun 17 17:27:50 2019 +0800
Revert "enable cleaning up idle cached executors when guc
gp_vmem_idle_resource_timeout specificed timer expires"
This reverts commit 1d755ec2e28eb1752eb2b63372c67deeffeb4243.
---
src/backend/cdb/executormgr.c | 24 -----------------------
src/backend/cdb/poolmgr.c | 42 -----------------------------------------
src/backend/storage/lmgr/proc.c | 4 ++--
src/backend/tcop/postgres.c | 8 +-------
src/backend/utils/misc/guc.c | 2 +-
src/include/cdb/executormgr.h | 3 ---
src/include/cdb/poolmgr.h | 2 --
7 files changed, 4 insertions(+), 81 deletions(-)
diff --git a/src/backend/cdb/executormgr.c b/src/backend/cdb/executormgr.c
index 3fbb23d..5a1c15d 100644
--- a/src/backend/cdb/executormgr.c
+++ b/src/backend/cdb/executormgr.c
@@ -1096,27 +1096,3 @@ executormgr_destory(SegmentDatabaseDescriptor *desc)
pfree(desc);
}
-bool executormgr_has_cached_executor()
-{
- return executor_cache.cached_num > 0;
-}
-
-bool executormgr_clean_cached_executor_filter(PoolItem item)
-{
- SegmentDatabaseDescriptor *desc = (SegmentDatabaseDescriptor *)item;
- return desc->conn->asyncStatus == PGASYNC_IDLE;
-}
-
-void executormgr_clean_cached_executor()
-{
- /* go through each cached executor */
- int cleaned = 0;
- if (!executor_cache.init)
- {
- return;
- }
-
- cleaned = poolmgr_clean(executor_cache.pool, (PoolMgrIterateFilter)
executormgr_clean_cached_executor_filter);
- elog(DEBUG5, "cleaned %d idle executors", cleaned);
-}
-
diff --git a/src/backend/cdb/poolmgr.c b/src/backend/cdb/poolmgr.c
index 14e3c8b..eae0f04 100644
--- a/src/backend/cdb/poolmgr.c
+++ b/src/backend/cdb/poolmgr.c
@@ -184,45 +184,3 @@ poolmgr_iterate(PoolMgrState *pool, PoolMgrIterateFilter
filter, PoolMgrIterateC
return;
}
-int poolmgr_clean(struct PoolMgrState *pool, PoolMgrIterateFilter filter)
-{
- int res = 0;
- HASH_SEQ_STATUS hash_seq;
- PoolItemEntry *entry;
-
- if (!pool)
- return res;
-
- hash_seq_init(&hash_seq, pool->hashtable);
- while ((entry = hash_seq_search(&hash_seq)))
- {
- ListCell *curr = list_head(entry->list);
- ListCell *prev = NULL;
- while (curr != NULL)
- {
- PoolItem item = lfirst(curr);
- if (filter && !filter(item))
- {
- /* try next */
- prev = curr;
- curr = lnext(prev);
- continue;
- }
- /* clean now */
- res++;
- pool->callback(item);
- entry->list = list_delete_cell(entry->list, curr, prev);
- if (prev != NULL)
- {
- curr = lnext(prev);
- }
- else
- {
- curr = list_head(entry->list);
- }
- }
- }
- return res;
-}
-
-
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c
index afab97a..2d3097f 100644
--- a/src/backend/storage/lmgr/proc.c
+++ b/src/backend/storage/lmgr/proc.c
@@ -1399,9 +1399,9 @@ HandleClientWaitTimeout(void)
/*
* Free gangs to free up resources on the segDBs.
*/
- if (executormgr_has_cached_executor())
+ if (gangsExist())
{
- executormgr_clean_cached_executor();
+ cleanupAllIdleGangs();
}
}
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 66a1ac1..4928ce2 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -4803,15 +4803,9 @@ PostgresMain(int argc, char *argv[], const char
*username)
* This means giving the end user enough time to type
in the next SQL statement
*
*/
- if (IdleSessionGangTimeout > 0 &&
executormgr_has_cached_executor())
- {
+ if (IdleSessionGangTimeout > 0 && gangsExist())
if (!enable_sig_alarm( IdleSessionGangTimeout
/* ms */, false))
- {
elog(FATAL, "could not set timer for
client wait timeout");
- }
- } else if (IdleSessionGangTimeout == 0) {
- executormgr_clean_cached_executor();
- }
}
IdleTracker_DeactivateProcess();
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 5fb6589..15b6eb1 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -5056,7 +5056,7 @@ static struct config_int ConfigureNamesInt[] =
{
{"gp_vmem_idle_resource_timeout", PGC_USERSET,
CLIENT_CONN_OTHER,
gettext_noop("Sets the time a session can be idle (in
milliseconds) before we release gangs on the segment DBs to free resources."),
- gettext_noop("A value of 0 means closing idle gangs at
once"),
+ gettext_noop("A value of 0 turns off the timeout."),
GUC_UNIT_MS | GUC_GPDB_ADDOPT
},
&IdleSessionGangTimeout,
diff --git a/src/include/cdb/executormgr.h b/src/include/cdb/executormgr.h
index ce4442d..31d44fa 100644
--- a/src/include/cdb/executormgr.h
+++ b/src/include/cdb/executormgr.h
@@ -98,8 +98,5 @@ extern bool executormgr_connect(struct
SegmentDatabaseDescriptor *desc,
bool is_writer, bool
is_superuser);
extern void executormgr_free_executor(struct SegmentDatabaseDescriptor *desc);
-extern bool executormgr_has_cached_executor();
-extern void executormgr_clean_cached_executor();
-
#endif /* EXECUTORMGR_H */
diff --git a/src/include/cdb/poolmgr.h b/src/include/cdb/poolmgr.h
index 8408c25..2821dd9 100644
--- a/src/include/cdb/poolmgr.h
+++ b/src/include/cdb/poolmgr.h
@@ -32,8 +32,6 @@ typedef bool (*PoolMgrIterateFilter) (PoolItem item);
extern struct PoolMgrState *poolmgr_create_pool(MemoryContext ctx,
PoolMgrCleanCallback callback);
extern bool poolmgr_drop_pool(struct PoolMgrState *pool);
-extern int poolmgr_clean(struct PoolMgrState *pool, PoolMgrIterateFilter
filter);
-
extern PoolItem poolmgr_get_item_by_name(struct PoolMgrState *pool, const char
*name);
extern PoolItem poolmgr_get_random_item(struct PoolMgrState *pool);
extern void poolmgr_put_item(struct PoolMgrState *pool, const char *name,
PoolItem item);