Skip to content

Commit 53a4936

Browse files
committed
Doc: add commentary about cowboy assignment of maintenance_work_mem.
Whilst working on commit 041e8b9 I happened to notice that parallel_vacuum_main() assigns directly to the maintenance_work_mem GUC. This is definitely not per project conventions, so I tried to fix it to use SetConfigOption(). But that fails with "parameter cannot be set during a parallel operation". It doesn't seem worth working on a cleaner answer, at least not till we have a few more instances of similar problems. But add some commentary, just so nobody gets the idea that this is an approved way to set a GUC.
1 parent d4c3a6b commit 53a4936

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/backend/commands/vacuumparallel.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,13 @@ parallel_vacuum_main(dsm_segment *seg, shm_toc *toc)
10321032
vac_open_indexes(rel, RowExclusiveLock, &nindexes, &indrels);
10331033
Assert(nindexes > 0);
10341034

1035+
/*
1036+
* Apply the desired value of maintenance_work_mem within this process.
1037+
* Really we should use SetConfigOption() to change a GUC, but since we're
1038+
* already in parallel mode guc.c would complain about that. Fortunately,
1039+
* by the same token guc.c will not let any user-defined code change it.
1040+
* So just avert your eyes while we do this:
1041+
*/
10351042
if (shared->maintenance_work_mem_worker > 0)
10361043
maintenance_work_mem = shared->maintenance_work_mem_worker;
10371044

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy