!2553 优化hint warning的处理逻辑

Merge pull request !2553 from april01xxx/dev_003_hint_warning
This commit is contained in:
opengauss-bot 2023-01-19 09:00:04 +00:00 committed by Gitee
commit 788274ba24
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 22 additions and 1 deletions

View File

@ -1490,6 +1490,10 @@ HintState* create_hintstate(const char* hints)
hstate->cache_plan_hint = keep_last_hint_cell(hstate->cache_plan_hint);
}
if (hstate && hstate->hint_warning != NULL) {
u_sess->parser_cxt.has_hintwarning = true;
}
pfree_ext(hint_str);
return hstate;
}

View File

@ -587,7 +587,10 @@ PlannedStmt* standard_planner(Query* parse, int cursorOptions, ParamListInfo bou
glob->vectorized = false;
/* Assume work mem is at least 1/4 of query mem */
glob->minopmem = Min(available_mem / 4, OPT_MAX_OP_MEM);
parse_hint_warning = retrieve_query_hint_warning((Node*)parse);
if (u_sess->parser_cxt.has_hintwarning) {
parse_hint_warning = retrieve_query_hint_warning((Node*)parse);
}
/*
* Set up default exec_nodes, we fist build re-cursively iterate parse->rtable

View File

@ -2866,6 +2866,9 @@ static void exec_simple_query(const char* query_string, MessageType messageType,
/* Reset the single_shard_stmt flag */
u_sess->exec_cxt.single_shard_stmt = false;
/* Reset hint flag */
u_sess->parser_cxt.has_hintwarning = false;
MemoryContextDelete(OptimizerContext);
/*
@ -5154,6 +5157,9 @@ static void exec_execute_message(const char* portal_name, long max_rows)
WLMParctlRelease(&t_thrd.wlm_cxt.parctl_state);
}
/* Reset hint flag */
u_sess->parser_cxt.has_hintwarning = false;
/*
* Emit duration logging if appropriate.
*/
@ -7746,6 +7752,9 @@ int PostgresMain(int argc, char* argv[], const char* dbname, const char* usernam
gstrace_tryblock_exit(true, oldTryCounter);
Assert(t_thrd.proc->dw_pos == -1);
/* Reset hint flag */
u_sess->parser_cxt.has_hintwarning = false;
(void)pgstat_report_waitstatus(STATE_WAIT_UNDEFINED);
t_thrd.pgxc_cxt.GlobalNetInstr = NULL;
/* output the memory tracking information when error happened */
@ -11680,6 +11689,9 @@ static void exec_batch_bind_execute(StringInfo input_message)
/* end batch, reset gpc batch flag */
u_sess->pcache_cxt.gpc_in_batch = false;
/* Reset hint flag */
u_sess->parser_cxt.has_hintwarning = false;
/* Done with the snapshot used */
if (snapshot_set)
PopActiveSnapshot();

View File

@ -422,6 +422,8 @@ typedef struct knl_u_parser_context {
bool isCreateFuncOrProc;
bool isTimeCapsule;
bool has_hintwarning;
} knl_u_parser_context;
typedef struct knl_u_trigger_context {