!4821 禁用collected_info_hashtbl、explain_info_hashtbl

Merge pull request !4821 from 吴岳川/hashtab
This commit is contained in:
opengauss_bot
2024-02-06 02:09:33 +00:00
committed by Gitee
4 changed files with 15 additions and 20 deletions

View File

@ -35,8 +35,8 @@ OBJS = $(CPP_SRCS:.cpp=.o)
all: libgauss_cl_jni.so
# Makefile.shlib has declare target: libgauss_cl_jni.so
libgauss_cl_jni.so: $(OBJS)
$(CC) -fPIC -shared $(CPPFLAGS) $^ $(LDFLAGS) $(LDLIBS) -o $@
install: all installdirs
$(INSTALL_DATA) libgauss_cl_jni.so$(X) '$(DESTDIR)$(bindir)/../lib/libgauss_cl_jni.so$(X)'

View File

@ -1429,26 +1429,30 @@ void InitPlan(QueryDesc *queryDesc, int eflags)
estate->dataDestRelIndex = plannedstmt->dataDestRelIndex;
}
/* deprecated: explain_info_hashtbl/collected_info_hashtbl
* set false disable data insertion into the hash table.
* deprecated function:
* - pg_stat_get_wlm_realtime_operator_info
* - pg_stat_get_wlm_realtime_ec_operator_info
* - pg_stat_get_wlm_ec_operator_info
* - gs_stat_get_wlm_plan_operator_info
* - pg_stat_get_wlm_operator_info
* */
estate->es_can_realtime_statistics = false;
estate->es_can_history_statistics = false;
if (u_sess->attr.attr_resource.use_workload_manager &&
u_sess->attr.attr_resource.resource_track_level == RESOURCE_TRACK_OPERATOR && !IsInitdb) {
int max_plan_id = plannedstmt->num_plannodes;
int current_realtime_num = hash_get_num_entries(g_operator_table.explain_info_hashtbl);
if (current_realtime_num + max_plan_id < g_operator_table.max_realtime_num) {
/* too many collect info now, ignore this time. */
estate->es_can_realtime_statistics = true;
} else {
if (current_realtime_num != 0) {
/* unreached branch */
ereport(LOG, (errmsg("Too many realtime info in the memory, current realtime record num is %d.",
current_realtime_num)));
}
int current_collectinfo_num = hash_get_num_entries(g_operator_table.collected_info_hashtbl);
if (current_collectinfo_num + max_plan_id <= g_operator_table.max_collectinfo_num) {
/* too many collect info now, ignore this time. */
estate->es_can_history_statistics = true;
} else {
if (current_collectinfo_num != 0) {
/* unreached branch */
ereport(LOG, (errmsg("Too many history info in the memory, current history record num is %d.",
current_collectinfo_num)));
}

View File

@ -3156,12 +3156,6 @@ void InitOperStatProfile(void)
&hash_ctl1,
HASH_ELEM | HASH_SHRCTX | HASH_FUNCTION | HASH_COMPARE | HASH_PARTITION);
const int max_work_mem = 10 * MBYTES; // 10MB
const int detail_mem = 20 * MBYTES;
g_operator_table.max_realtime_num = max_work_mem / sizeof(ExplainDNodeInfo);
g_operator_table.max_collectinfo_num = detail_mem / sizeof(ExplainDNodeInfo);
MemoryContextSwitchTo(old_context);
}

View File

@ -901,9 +901,6 @@ typedef struct Qpid {
} Qpid;
typedef struct OperatorProfileTable {
int max_realtime_num; /* max session info num in the hash table */
int max_collectinfo_num; /* max collect info num in list */
HTAB* explain_info_hashtbl; /* collect information hash table */
HTAB* collected_info_hashtbl; /* collect information hash table */
} OperatorProfileTable;