Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit93a0aa2

Browse files
funbringerdanolivo
authored andcommitted
various style fixes
1 parentedfa892 commit93a0aa2

File tree

7 files changed

+60
-82
lines changed

7 files changed

+60
-82
lines changed

‎aqo.c‎

Lines changed: 34 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
PG_MODULE_MAGIC;
44

5-
void_PG_init(void);
6-
void_PG_fini(void);
5+
void_PG_init(void);
6+
77

88
/* Strategy of determining feature space for new queries. */
99
intaqo_mode;
@@ -50,17 +50,17 @@ boolexplain_aqo;
5050
instr_timequery_starttime;
5151
doublequery_planning_time;
5252

53-
/* Saved hook valuesin case of unload*/
54-
post_parse_analyze_hook_typeprev_post_parse_analyze_hook;
55-
planner_hook_typeprev_planner_hook;
56-
ExecutorStart_hook_typeprev_ExecutorStart_hook;
57-
ExecutorEnd_hook_typeprev_ExecutorEnd_hook;
58-
set_baserel_rows_estimate_hook_typeprev_set_baserel_rows_estimate_hook;
59-
get_parameterized_baserel_size_hook_typeprev_get_parameterized_baserel_size_hook;
60-
set_joinrel_size_estimates_hook_typeprev_set_joinrel_size_estimates_hook;
61-
get_parameterized_joinrel_size_hook_typeprev_get_parameterized_joinrel_size_hook;
62-
copy_generic_path_info_hook_typeprev_copy_generic_path_info_hook;
63-
ExplainOnePlan_hook_typeprev_ExplainOnePlan_hook;
53+
/* Saved hook values */
54+
post_parse_analyze_hook_typeprev_post_parse_analyze_hook;
55+
planner_hook_typeprev_planner_hook;
56+
ExecutorStart_hook_typeprev_ExecutorStart_hook;
57+
ExecutorEnd_hook_typeprev_ExecutorEnd_hook;
58+
set_baserel_rows_estimate_hook_typeprev_set_baserel_rows_estimate_hook;
59+
get_parameterized_baserel_size_hook_typeprev_get_parameterized_baserel_size_hook;
60+
set_joinrel_size_estimates_hook_typeprev_set_joinrel_size_estimates_hook;
61+
get_parameterized_joinrel_size_hook_typeprev_get_parameterized_joinrel_size_hook;
62+
copy_generic_path_info_hook_typeprev_copy_generic_path_info_hook;
63+
ExplainOnePlan_hook_typeprev_ExplainOnePlan_hook;
6464

6565
/*****************************************************************************
6666
*
@@ -83,49 +83,28 @@ _PG_init(void)
8383
NULL,
8484
NULL);
8585

86-
prev_planner_hook=planner_hook;
87-
planner_hook=&aqo_planner;
88-
prev_post_parse_analyze_hook=post_parse_analyze_hook;
89-
post_parse_analyze_hook=&get_query_text;
90-
prev_ExecutorStart_hook=ExecutorStart_hook;
91-
ExecutorStart_hook=&aqo_ExecutorStart;
92-
prev_ExecutorEnd_hook=ExecutorEnd_hook;
93-
ExecutorEnd_hook=&learn_query_stat;
94-
prev_set_baserel_rows_estimate_hook=set_baserel_rows_estimate_hook;
95-
set_baserel_rows_estimate_hook=&aqo_set_baserel_rows_estimate;
96-
prev_get_parameterized_baserel_size_hook=
97-
get_parameterized_baserel_size_hook;
98-
get_parameterized_baserel_size_hook=
99-
&aqo_get_parameterized_baserel_size;
100-
prev_set_joinrel_size_estimates_hook=set_joinrel_size_estimates_hook;
101-
set_joinrel_size_estimates_hook=&aqo_set_joinrel_size_estimates;
102-
prev_get_parameterized_joinrel_size_hook=
103-
get_parameterized_joinrel_size_hook;
104-
get_parameterized_joinrel_size_hook=
105-
&aqo_get_parameterized_joinrel_size;
106-
prev_copy_generic_path_info_hook=copy_generic_path_info_hook;
107-
copy_generic_path_info_hook=&aqo_copy_generic_path_info;
108-
prev_ExplainOnePlan_hook=ExplainOnePlan_hook;
109-
ExplainOnePlan_hook=print_into_explain;
110-
init_deactivated_queries_storage();
111-
}
86+
prev_planner_hook=planner_hook;
87+
planner_hook=aqo_planner;
88+
prev_post_parse_analyze_hook=post_parse_analyze_hook;
89+
post_parse_analyze_hook=get_query_text;
90+
prev_ExecutorStart_hook=ExecutorStart_hook;
91+
ExecutorStart_hook=aqo_ExecutorStart;
92+
prev_ExecutorEnd_hook=ExecutorEnd_hook;
93+
ExecutorEnd_hook=learn_query_stat;
94+
prev_set_baserel_rows_estimate_hook=set_baserel_rows_estimate_hook;
95+
set_baserel_rows_estimate_hook=aqo_set_baserel_rows_estimate;
96+
prev_get_parameterized_baserel_size_hook=get_parameterized_baserel_size_hook;
97+
get_parameterized_baserel_size_hook=aqo_get_parameterized_baserel_size;
98+
prev_set_joinrel_size_estimates_hook=set_joinrel_size_estimates_hook;
99+
set_joinrel_size_estimates_hook=aqo_set_joinrel_size_estimates;
100+
prev_get_parameterized_joinrel_size_hook=get_parameterized_joinrel_size_hook;
101+
get_parameterized_joinrel_size_hook=aqo_get_parameterized_joinrel_size;
102+
prev_copy_generic_path_info_hook=copy_generic_path_info_hook;
103+
copy_generic_path_info_hook=aqo_copy_generic_path_info;
104+
prev_ExplainOnePlan_hook=ExplainOnePlan_hook;
105+
ExplainOnePlan_hook=print_into_explain;
112106

113-
void
114-
_PG_fini(void)
115-
{
116-
planner_hook=prev_planner_hook;
117-
post_parse_analyze_hook=prev_post_parse_analyze_hook;
118-
ExecutorStart_hook=prev_ExecutorStart_hook;
119-
ExecutorEnd_hook=prev_ExecutorEnd_hook;
120-
set_baserel_rows_estimate_hook=prev_set_baserel_rows_estimate_hook;
121-
get_parameterized_baserel_size_hook=
122-
prev_get_parameterized_baserel_size_hook;
123-
set_joinrel_size_estimates_hook=prev_set_joinrel_size_estimates_hook;
124-
get_parameterized_joinrel_size_hook=
125-
prev_get_parameterized_joinrel_size_hook;
126-
copy_generic_path_info_hook=prev_copy_generic_path_info_hook;
127-
ExplainOnePlan_hook=prev_ExplainOnePlan_hook;
128-
fini_deactivated_queries_storage();
107+
init_deactivated_queries_storage();
129108
}
130109

131110
PG_FUNCTION_INFO_V1(invalidate_deactivated_queries_cache);

‎aqo.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ typedef struct
183183
intplanning_time_without_aqo_size;
184184
intcardinality_error_with_aqo_size;
185185
intcardinality_error_without_aqo_size;
186-
long longexecutions_with_aqo;
187-
long longexecutions_without_aqo;
186+
int64executions_with_aqo;
187+
int64executions_without_aqo;
188188
}QueryStat;
189189

190190
/* Parameters of autotuning */

‎auto_tuning.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ automatical_query_tuning(int query_hash, QueryStat * stat)
125125
doublet_aqo,
126126
t_not_aqo;
127127
doublep_use=-1;
128-
long longnum_iterations;
128+
int64num_iterations;
129129

130130
num_iterations=stat->executions_with_aqo+stat->executions_without_aqo;
131131
learn_aqo= true;

‎cardinality_hooks.c‎

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void
4545
call_default_set_baserel_rows_estimate(PlannerInfo*root,RelOptInfo*rel)
4646
{
4747
if (prev_set_baserel_rows_estimate_hook)
48-
(*prev_set_baserel_rows_estimate_hook)(root,rel);
48+
prev_set_baserel_rows_estimate_hook(root,rel);
4949
else
5050
set_baserel_rows_estimate_standard(root,rel);
5151
}
@@ -59,11 +59,9 @@ call_default_get_parameterized_baserel_size(PlannerInfo *root,
5959
List*param_clauses)
6060
{
6161
if (prev_get_parameterized_baserel_size_hook)
62-
return (*prev_get_parameterized_baserel_size_hook) (root,rel,
63-
param_clauses);
62+
returnprev_get_parameterized_baserel_size_hook(root,rel,param_clauses);
6463
else
65-
returnget_parameterized_baserel_size_standard(root,rel,
66-
param_clauses);
64+
returnget_parameterized_baserel_size_standard(root,rel,param_clauses);
6765
}
6866

6967
/*
@@ -78,11 +76,11 @@ call_default_get_parameterized_joinrel_size(PlannerInfo *root,
7876
List*restrict_clauses)
7977
{
8078
if (prev_get_parameterized_joinrel_size_hook)
81-
return(*prev_get_parameterized_joinrel_size_hook)(root,rel,
82-
outer_path,
83-
inner_path,
84-
sjinfo,
85-
restrict_clauses);
79+
returnprev_get_parameterized_joinrel_size_hook(root,rel,
80+
outer_path,
81+
inner_path,
82+
sjinfo,
83+
restrict_clauses);
8684
else
8785
returnget_parameterized_joinrel_size_standard(root,rel,
8886
outer_path,
@@ -102,11 +100,11 @@ call_default_set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
102100
List*restrictlist)
103101
{
104102
if (prev_set_joinrel_size_estimates_hook)
105-
(*prev_set_joinrel_size_estimates_hook)(root,rel,
106-
outer_rel,
107-
inner_rel,
108-
sjinfo,
109-
restrictlist);
103+
prev_set_joinrel_size_estimates_hook(root,rel,
104+
outer_rel,
105+
inner_rel,
106+
sjinfo,
107+
restrictlist);
110108
else
111109
set_joinrel_size_estimates_standard(root,rel,
112110
outer_rel,

‎hash.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ has_consts(List *lst)
566566
/*
567567
* Returns pointer on the args list in clause or NULL.
568568
*/
569-
List**
569+
List**
570570
get_clause_args_ptr(Expr*clause)
571571
{
572572
switch (clause->type)
@@ -595,6 +595,7 @@ get_clause_args_ptr(Expr *clause)
595595
bool
596596
clause_is_eq_clause(Expr*clause)
597597
{
598+
/* TODO: fix this horrible mess */
598599
return (
599600
clause->type==T_OpExpr||
600601
clause->type==T_DistinctExpr||
@@ -658,5 +659,4 @@ clause_is_eq_clause(Expr *clause)
658659
((OpExpr*)clause)->opno==3240||
659660
((OpExpr*)clause)->opno==3240
660661
);
661-
/* TBD: make this less awful */
662662
}

‎postprocessing.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static void update_query_stat_row(double *et, int *et_size,
3636
doubleplanning_time,
3737
doubleexecution_time,
3838
doublecardinality_error,
39-
long long*n_exec);
39+
int64*n_exec);
4040

4141

4242
/*
@@ -264,7 +264,7 @@ update_query_stat_row(double *et, int *et_size,
264264
doubleplanning_time,
265265
doubleexecution_time,
266266
doublecardinality_error,
267-
long long*n_exec)
267+
int64*n_exec)
268268
{
269269
inti;
270270

@@ -313,7 +313,7 @@ aqo_ExecutorStart(QueryDesc *queryDesc, int eflags)
313313
queryDesc->instrument_options |=INSTRUMENT_ROWS;
314314

315315
if (prev_ExecutorStart_hook)
316-
(*prev_ExecutorStart_hook)(queryDesc,eflags);
316+
prev_ExecutorStart_hook(queryDesc,eflags);
317317
else
318318
standard_ExecutorStart(queryDesc,eflags);
319319
}
@@ -348,7 +348,7 @@ aqo_copy_generic_path_info(PlannerInfo *root, Plan *dest, Path *src)
348348
dest->was_parametrized= (src->param_info!=NULL);
349349

350350
if (prev_copy_generic_path_info_hook)
351-
(*prev_copy_generic_path_info_hook)(root,dest,src);
351+
prev_copy_generic_path_info_hook(root,dest,src);
352352
}
353353

354354
/*
@@ -439,7 +439,7 @@ learn_query_stat(QueryDesc *queryDesc)
439439
disable_aqo_for_query();
440440

441441
if (prev_ExecutorEnd_hook)
442-
(*prev_ExecutorEnd_hook)(queryDesc);
442+
prev_ExecutorEnd_hook(queryDesc);
443443
else
444444
standard_ExecutorEnd(queryDesc);
445445
}

‎preprocessing.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ get_query_text(ParseState *pstate, Query *query)
6969
{
7070
if (pstate)
7171
query_text=pstate->p_sourcetext;
72+
7273
if (prev_post_parse_analyze_hook)
73-
(*prev_post_parse_analyze_hook)(pstate,query);
74+
prev_post_parse_analyze_hook(pstate,query);
7475
}
7576

7677
/*
@@ -82,7 +83,7 @@ call_default_planner(Query *parse,
8283
ParamListInfoboundParams)
8384
{
8485
if (prev_planner_hook)
85-
return(*prev_planner_hook)(parse,cursorOptions,boundParams);
86+
returnprev_planner_hook(parse,cursorOptions,boundParams);
8687
else
8788
returnstandard_planner(parse,cursorOptions,boundParams);
8889
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp