Skip to content

Bugfix. Switch off quickly all AQO features if queryId is disabled. #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 28, 2023

Conversation

danolivo
Copy link
Collaborator

@danolivo danolivo commented Mar 24, 2023

One installcheck test was added into the github actions workflow.

Push it into stable14 and master as quick as possible.
stable13 based on custom query hash and don't needed this.
Remember! The master branch can contain one more hook! Check it.

@danolivo danolivo added the bug label Mar 24, 2023
@danolivo danolivo added this to the AQO 1.6 milestone Mar 24, 2023
@danolivo danolivo requested a review from Alena0704 March 24, 2023 03:32
@danolivo danolivo self-assigned this Mar 24, 2023
Copy link
Collaborator

@Anisimov-ds Anisimov-ds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вопросы только по объявленным, но неиспользуемым хукам в cardinality_hooks.c

aqo.c Outdated
/* Saved hooks */
static planner_hook_type prev_planner_hook = NULL;
static ExecutorStart_hook_type prev_ExecutorStart_hook = NULL;
static ExecutorRun_hook_type prev_ExecutorRun = NULL;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Остальные хуки именуются *_hook, а prev_ExecutorRun отличается от остальных.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

set_baserel_rows_estimate_hook_type prev_set_baserel_rows_estimate_hook = NULL;
get_parameterized_baserel_size_hook_type prev_get_parameterized_baserel_size_hook = NULL;
set_joinrel_size_estimates_hook_type prev_set_joinrel_size_estimates_hook = NULL;
get_parameterized_joinrel_size_hook_type prev_get_parameterized_joinrel_size_hook = NULL;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Эти переменные используются только в aqo.c, но там они переобъявлены.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -33,103 +33,16 @@
#include "machine_learning.h"
#include "path_utils.h"

estimate_num_groups_hook_type prev_estimate_num_groups_hook = NULL;
estimate_num_groups_hook_type prev_estimate_num_groups_hook = NULL;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prev_estimate_num_groups_hook используется в функции aqo_estimate_num_groups_hook() для проверки, что нет посторонних хуков.
Наверное, проверку можно вынести в PG_init()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не согласен. Кто-то может позже переопределить хук. Добавил более строгую проверку

@danolivo danolivo force-pushed the off-without-queryid branch 2 times, most recently from 2dc14d9 to cacc8c2 Compare March 25, 2023 15:05
different libraries.

To avoid such a problem in future, refactor AQO interfaces: declare all
hooks as static, reduce number of exporting functions and introduce
concept of *_init() function for a module that needs some actions in the
PG_init() routine.

Reviewed by: @Anisimov-ds
One installcheck test was added into the github actions workflow.

Reviewed by: @Anisimov-ds
@danolivo danolivo force-pushed the off-without-queryid branch from cacc8c2 to 700ed29 Compare March 25, 2023 15:17
danolivo and others added 2 commits March 25, 2023 22:13
…n of AQO

prediction hooks. It isn't a strict rule, but we should know about that.
@danolivo danolivo merged commit 271b0da into stable15 Mar 28, 2023
@danolivo danolivo deleted the off-without-queryid branch March 28, 2023 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants