8000 Add basic regression test on FDW support. · postgrespro/aqo@f6396e2 · GitHub
[go: up one dir, main page]

Skip to content

Commit f6396e2

Browse files
danolivoAndrey Lepikhov
authored andcommitted
Add basic regression test on FDW support.
Switch from AQO_EXPLAIN define to the two user GUCS: aqo.details and aqo.show_hash. New ExplainOneNode hook allows to add info into explain of each node.
1 parent 5b4b48c commit f6396e2

File tree

7 files changed

+295
-159
lines changed

7 files changed

+295
-159
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ REGRESS = aqo_disabled \
1414
aqo_forced \
1515
aqo_learn \
1616
schema \
17+
aqo_fdw \
1718
aqo_CVE-2020-14350
1819

1920
fdw_srcdir = $(top_srcdir)/contrib/postgres_fdw
2021
PG_CPPFLAGS += -I$(libpq_srcdir) -I$(fdw_srcdir)
2122
EXTRA_REGRESS_OPTS=--temp-config=$(top_srcdir)/$(subdir)/conf.add
23+
EXTRA_INSTALL = contrib/postgres_fdw
2224

2325
DATA = aqo--1.0.sql aqo--1.0--1.1.sql aqo--1.1--1.2.sql aqo--1.2.sql
2426

aqo.c

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ void _PG_init(void);
1818
/* Strategy of determining feature space for new queries. */
1919
int aqo_mode;
2020
bool force_collect_stat;
21+
bool aqo_show_hash;
22+
bool aqo_details;
2123

2224
/* GUC variables */
2325
static const struct config_enum_entry format_options[] = {
@@ -83,6 +85,7 @@ set_joinrel_size_estimates_hook_type prev_set_joinrel_size_estimates_hook;
8385
get_parameterized_joinrel_size_hook_type prev_get_parameterized_joinrel_size_hook;
8486
copy_generic_path_info_hook_type prev_copy_generic_path_info_hook;
8587
ExplainOnePlan_hook_type prev_ExplainOnePlan_hook;
88+
ExplainOneNode_hook_type prev_ExplainOneNode_hook;
8689

8790
/*****************************************************************************
8891
*
@@ -116,7 +119,33 @@ _PG_init(void)
116119
NULL,
117120
NULL,
118121
NULL
119-
);
122+
);
123+
124+
DefineCustomBoolVariable(
125+
"aqo.show_hash",
126+
"Show query and node hash on explain.",
127+
"Hash value depend on each instance and is not good to enable it in regression or TAP tests.",
128+
&aqo_show_hash,
129+
false,
130+
PGC_USERSET,
131+
0,
132+
NULL,
133+
NULL,
134+
NULL
135+
);
136+
137+
DefineCustomBoolVariable(
138+
"aqo.details",
139+
"Show AQO state on a query.",
140+
NULL,
141+
&aqo_details,
142+
false,
143+
PGC_USERSET,
144+
0,
145+
NULL,
146+
NULL,
147+
NULL
148+
);
120149

121150
prev_planner_hook = planner_hook;
122151
planner_hook = aqo_planner;
@@ -139,6 +168,8 @@ _PG_init(void)
139168
copy_generic_path_info_hook = aqo_copy_generic_path_info;
140169
prev_ExplainOnePlan_hook = ExplainOnePlan_hook;
141170
ExplainOnePlan_hook = print_into_explain;
171+
prev_ExplainOneNode_hook = ExplainOneNode_hook;
172+
ExplainOneNode_hook = print_node_explain;
142173
parampathinfo_postinit_hook = ppi_hook;
143174

144175
init_deactivated_queries_storage();

aqo.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ typedef enum
174174

175175
extern int aqo_mode;
176176
extern bool force_collect_stat;
177+
extern bool aqo_show_hash;
178+
extern bool aqo_details;
177179

178180
/*
179181
* It is mostly needed for auto tuning of query. with auto tuning mode aqo
@@ -312,6 +314,10 @@ void print_into_explain(PlannedStmt *plannedstmt, IntoClause *into,
312314
ExplainState *es, const char *queryString,
313315
ParamListInfo params, const instr_time *planduration,
314316
QueryEnvironment *queryEnv);
317+
extern void print_node_explain(ExplainState *es,
318+
PlanState *ps,
319+
Plan *plan,
320+
double rows);
315321
void disable_aqo_for_query(void);
316322

317323
/* Cardinality estimation hooks */

0 commit comments

Comments
 (0)
0