Skip to content
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

Fix 'gpconfig' behave test #1158

Open
wants to merge 3 commits into
base: feature/ADBDEV-6552
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/backend/utils/misc/guc_gp.c
Original file line number Diff line number Diff line change
Expand Up @@ -5167,7 +5167,7 @@ check_optimizer(bool *newval, void **extra, GucSource source)
*/
if (GP_ROLE_DISPATCH != Gp_role)
*newval = false;
else if (NULL == planner_hook)
else if (source > PGC_S_ARGV && NULL == planner_hook)
{
/*
* Assume that, if no planner_hook is registered for the
Expand All @@ -5177,6 +5177,16 @@ check_optimizer(bool *newval, void **extra, GucSource source)
GUC_check_errmsg("External planner is not registered");
return false;
}
else if (NULL == planner_hook)
/*
* But in case GUC source <= PGC_S_ARGV, this function may be called
* before external planner is loaded from a shared lib. For ex.,
* user may set the GUC in 'postgresql.conf', so system will try to
* apply the GUC before the init of shared libs. We need to allow
* such cases, assuming that the user knows what he is doing.
*/
elog(LOG, "'optimizer' is explicitly set to 'on'. "
Copy link
Member

Choose a reason for hiding this comment

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

maybe warning?

Copy link
Author

@whitehawk whitehawk Dec 16, 2024

Choose a reason for hiding this comment

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

I thought about it.

I think that warning is considered to be smth that is better to fix. But there will be no way the user can fix this warning with current Postgres GUC architecture. So it can be uncomfortable for a pedantic user.

I wanted to have a kind of a hint for the user, thus I chose LOG instead of WARNING.

"Please ensure that an external planner is added to 'shared_preload_libraries'");
}

if (!optimizer_control)
Expand Down
Loading