forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit62d16c7
committed
Improve design and implementation of pg_file_settings view.
As first committed, this view reported on the file contents as they wereat the last SIGHUP event. That's not as useful as reporting on the currentcontents, and what's more, it didn't work right on Windows unless thecurrent session had serviced at least one SIGHUP. Therefore, arrange tore-read the files when pg_show_all_settings() is called. This requiresonly minor refactoring so that we can pass changeVal = false toset_config_option() so that it won't actually apply any changes locally.In addition, add error reporting so that errors that would prevent theconfiguration files from being loaded, or would prevent individual settingsfrom being applied, are visible directly in the view. This makes the viewusable for pre-testing whether edits made in the config files will have thedesired effect, before one actually issues a SIGHUP.I also added an "applied" column so that it's easy to identify entries thatare superseded by later entries; this was the main use-case for the originaldesign, but it seemed unnecessarily hard to use for that.Also fix a 9.4.1 regression that allowed multiple entries for aPGC_POSTMASTER variable to cause bogus complaints in the postmaster log.(The issue here was that commitbf007a2 unintentionally reverted3e3f659, which suppressed any duplicate entries withinParseConfigFp. However, since the original coding of the pg_file_settingsview depended on such suppression *not* happening, we couldn't have fixedthis issue now without first doing something with pg_file_settings.Now we suppress duplicates by marking them "ignored" withinProcessConfigFileInternal, which doesn't hide them in the view.)Lesser changes include:Drive the view directly off the ConfigVariable list, instead of making abasically-equivalent second copy of the data. There's no longer any needto hang onto the data permanently, anyway.Convert show_all_file_settings() to do its work in one call and return atuplestore; this avoids risks associated with assuming that the GUC statewill hold still over the course of query execution. (I think there wereprobably latent bugs here, though you might need something like a cursoron the view to expose them.)Arrange to run SIGHUP processing in a short-lived memory context, toforestall process-lifespan memory leaks. (There is one known leak in thiscode, in ProcessConfigDirectory; it seems minor enough to not be worthback-patching a specific fix for.)Remove mistaken assignment to ConfigFileLineno that caused line countingafter an include_dir directive to be completely wrong.Add missed failure check in AlterSystemSetConfigFile(). We don't reallyexpect ParseConfigFp() to fail, but that's not an excuse for not checking.1 parentd661532 commit62d16c7
File tree
9 files changed
+430
-245
lines changed- doc/src/sgml
- src
- backend/utils/misc
- include
- catalog
- utils
- test/regress/expected
9 files changed
+430
-245
lines changedLines changed: 53 additions & 19 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7626 | 7626 |
| |
7627 | 7627 |
| |
7628 | 7628 |
| |
7629 |
| - | |
| 7629 | + | |
7630 | 7630 |
| |
7631 | 7631 |
| |
7632 | 7632 |
| |
| |||
8007 | 8007 |
| |
8008 | 8008 |
| |
8009 | 8009 |
| |
8010 |
| - | |
8011 |
| - | |
8012 |
| - | |
8013 |
| - | |
8014 |
| - | |
8015 |
| - | |
8016 |
| - | |
| 8010 | + | |
| 8011 | + | |
| 8012 | + | |
| 8013 | + | |
| 8014 | + | |
| 8015 | + | |
| 8016 | + | |
| 8017 | + | |
| 8018 | + | |
| 8019 | + | |
| 8020 | + | |
| 8021 | + | |
| 8022 | + | |
| 8023 | + | |
| 8024 | + | |
| 8025 | + | |
| 8026 | + | |
| 8027 | + | |
| 8028 | + | |
| 8029 | + | |
8017 | 8030 |
| |
8018 | 8031 |
| |
8019 | 8032 |
| |
| |||
8031 | 8044 |
| |
8032 | 8045 |
| |
8033 | 8046 |
| |
8034 |
| - | |
| 8047 | + | |
8035 | 8048 |
| |
8036 | 8049 |
| |
8037 | 8050 |
| |
8038 | 8051 |
| |
8039 | 8052 |
| |
8040 |
| - | |
| 8053 | + | |
8041 | 8054 |
| |
8042 | 8055 |
| |
8043 | 8056 |
| |
8044 | 8057 |
| |
8045 | 8058 |
| |
8046 |
| - | |
| 8059 | + | |
8047 | 8060 |
| |
8048 | 8061 |
| |
8049 | 8062 |
| |
8050 | 8063 |
| |
8051 |
| - | |
| 8064 | + | |
8052 | 8065 |
| |
8053 | 8066 |
| |
8054 | 8067 |
| |
8055 | 8068 |
| |
8056 |
| - | |
| 8069 | + | |
| 8070 | + | |
| 8071 | + | |
| 8072 | + | |
| 8073 | + | |
| 8074 | + | |
| 8075 | + | |
| 8076 | + | |
| 8077 | + | |
| 8078 | + | |
| 8079 | + | |
| 8080 | + | |
8057 | 8081 |
| |
8058 | 8082 |
| |
8059 | 8083 |
| |
8060 |
| - | |
| 8084 | + | |
8061 | 8085 |
| |
8062 | 8086 |
| |
8063 |
| - | |
8064 |
| - | |
| 8087 | + | |
| 8088 | + | |
| 8089 | + | |
| 8090 | + | |
| 8091 | + | |
| 8092 | + | |
| 8093 | + | |
| 8094 | + | |
| 8095 | + | |
| 8096 | + | |
| 8097 | + | |
| 8098 | + | |
| 8099 | + | |
8065 | 8100 |
| |
8066 | 8101 |
| |
8067 | 8102 |
| |
8068 |
| - | |
8069 |
| - | |
8070 |
| - | |
| 8103 | + | |
| 8104 | + | |
8071 | 8105 |
| |
8072 | 8106 |
| |
8073 | 8107 |
| |
|
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
175 | 175 |
| |
176 | 176 |
| |
177 | 177 |
| |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
178 | 186 |
| |
179 | 187 |
| |
180 | 188 |
| |
|
Lines changed: 8 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6 | 6 |
| |
7 | 7 |
| |
8 | 8 |
| |
9 |
| - | |
10 |
| - | |
| 9 | + | |
| 10 | + | |
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
| |||
23 | 23 |
| |
24 | 24 |
| |
25 | 25 |
| |
| 26 | + | |
26 | 27 |
| |
27 | 28 |
| |
28 | 29 |
| |
| |||
480 | 481 |
| |
481 | 482 |
| |
482 | 483 |
| |
483 |
| - | |
484 |
| - | |
485 |
| - | |
486 |
| - | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
487 | 488 |
| |
488 | 489 |
| |
489 | 490 |
| |
| |||
503 | 504 |
| |
504 | 505 |
| |
505 | 506 |
| |
506 |
| - | |
| 507 | + | |
507 | 508 |
| |
508 | 509 |
| |
509 | 510 |
| |
|
0 commit comments
Comments
(0)