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

Commitbf4f30a

Browse files
committed
Fix failure to verify PGC_[SU_]BACKEND GUCs in pg_file_settings view.
set_config_option() bails out early if it detects that the option tobe set is PGC_BACKEND or PGC_SU_BACKEND class and we're reading theconfig file in a postmaster child; we don't want to apply any newvalue in such a case. That's fine as far as it goes, but it failsto consider the requirements of the pg_file_settings view: for that,we need to check validity of the value even though we have nointention to apply it. Because we didn't, even very silly valuesfor affected GUCs would be reported as valid by the view. Thereare only half a dozen such GUCs, which perhaps explains why thisgot overlooked for so long.Fix by continuing when changeVal is false; this parallels the logicin some other early-exit paths.Also, the check added by commit924bcf4 to prevent GUC changes inparallel workers seems a few bricks shy of a load: it's evidentlyassuming that ereport(elevel, ...) won't return. Make sure webail out if it does. The lack of trouble reports suggests thatthis is only a latent bug, i.e. parallel workers don't actuallyreach here with elevel < ERROR. (Per the code coverage report,we never reach here at all in the regression suite.) But we clearlydon't want to risk proceeding if that does happen.Per report from Rıdvan Korkmaz. These are ancient bugs, so back-patchto all supported branches.Discussion:https://postgr.es/m/2089235.1703617353@sss.pgh.pa.us
1 parent7978eee commitbf4f30a

File tree

1 file changed

+8
-1
lines changed
  • src/backend/utils/misc

1 file changed

+8
-1
lines changed

‎src/backend/utils/misc/guc.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7329,9 +7329,12 @@ set_config_option(const char *name, const char *value,
73297329
* Other changes might need to affect other workers, so forbid them.
73307330
*/
73317331
if (IsInParallelMode()&&changeVal&&action!=GUC_ACTION_SAVE)
7332+
{
73327333
ereport(elevel,
73337334
(errcode(ERRCODE_INVALID_TRANSACTION_STATE),
73347335
errmsg("cannot set parameters during a parallel operation")));
7336+
return-1;
7337+
}
73357338

73367339
record=find_option(name, true, false,elevel);
73377340
if (record==NULL)
@@ -7416,6 +7419,10 @@ set_config_option(const char *name, const char *value,
74167419
* backends. This is a tad klugy, but necessary because we
74177420
* don't re-read the config file during backend start.
74187421
*
7422+
* However, if changeVal is false then plow ahead anyway since
7423+
* we are trying to find out if the value is potentially good,
7424+
* not actually use it.
7425+
*
74197426
* In EXEC_BACKEND builds, this works differently: we load all
74207427
* non-default settings from the CONFIG_EXEC_PARAMS file
74217428
* during backend start. In that case we must accept
@@ -7426,7 +7433,7 @@ set_config_option(const char *name, const char *value,
74267433
* started it. is_reload will be true when either situation
74277434
* applies.
74287435
*/
7429-
if (IsUnderPostmaster&& !is_reload)
7436+
if (IsUnderPostmaster&&changeVal&&!is_reload)
74307437
return-1;
74317438
}
74327439
elseif (context!=PGC_POSTMASTER&&

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp