From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Set the stack_base_ptr in main(), not in random other places. |
Date: | 2024-12-17 17:23:35 |
Message-ID: | E1tNbIF-000452-6X@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Set the stack_base_ptr in main(), not in random other places.
Previously we did this in PostmasterMain() and InitPostmasterChild(),
which meant that stack depth checking was disabled in non-postmaster
server processes, for instance in single-user mode. That seems like
a fairly bad idea, since there's no a-priori restriction on the
complexity of queries we will run in single-user mode. Moreover, this
led to not having quite the same stack depth limit in all processes,
which likely has no real-world effect but it offends my inner neatnik.
Setting the depth in main() guarantees that check_stack_depth() is
armed and has a consistent interpretation of stack depth in all forms
of server processes.
While at it, move the code associated with checking the stack depth
out of tcop/postgres.c (which was never a great home for it) into
a new file src/backend/utils/misc/stack_depth.c.
Discussion: https://postgr.es/m/2081982.1734393311@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/c91963da1302e8dd490bde115f3956f7d2f1258d
Modified Files
--------------
src/backend/main/main.c | 6 ++
src/backend/postmaster/postmaster.c | 5 -
src/backend/tcop/postgres.c | 173 ------------------------------
src/backend/utils/init/miscinit.c | 7 --
src/backend/utils/misc/Makefile | 1 +
src/backend/utils/misc/meson.build | 1 +
src/backend/utils/misc/stack_depth.c | 197 +++++++++++++++++++++++++++++++++++
src/include/miscadmin.h | 8 +-
src/include/tcop/tcopprot.h | 5 -
9 files changed, 212 insertions(+), 191 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Melanie Plageman | 2024-12-17 19:21:18 | pgsql: Count pages set all-visible and all-frozen in VM during vacuum |
Previous Message | Tomas Vondra | 2024-12-17 16:53:48 | pgsql: Detect version mismatch in brin_page_items |