pgsql: Refactor how InitProcess is called

2023-12-03 Thread Heikki Linnakangas
Refactor how InitProcess is called The order of process initialization steps is now more consistent between !EXEC_BACKEND and EXEC_BACKEND modes. InitProcess() is called at the same place in either mode. We can now also move the AttachSharedMemoryStructs() call into InitProcess() itself. This redu

pgsql: Refactor CreateSharedMemoryAndSemaphores

2023-12-03 Thread Heikki Linnakangas
Refactor CreateSharedMemoryAndSemaphores For clarity, have separate functions for *creating* the shared memory and semaphores at postmaster or single-user backend startup, and for *attaching* to existing shared memory structures in EXEC_BACKEND case. CreateSharedMemoryAndSemaphores() is now called

pgsql: Pass BackgroundWorker entry in the parameter file in EXEC_BACKEN

2023-12-03 Thread Heikki Linnakangas
Pass BackgroundWorker entry in the parameter file in EXEC_BACKEND mode The BackgroundWorker struct is now passed the same way as the Port struct. Seems more consistent. This makes it possible to move InitProcess later in SubPostmasterMain (in next commit), as we no longer need to access shared me

pgsql: doc: Remove reference to trigger file regarding promotion

2023-12-03 Thread Michael Paquier
doc: Remove reference to trigger file regarding promotion The wording changed here comes from 991bfe11d28a, when the only way to trigger a promotion was with a trigger file. There are more options to achieve this operation these days, like the SQL function pg_promote() or the command `pg_ctl prom

pgsql: doc: Remove reference to trigger file regarding promotion

2023-12-03 Thread Michael Paquier
doc: Remove reference to trigger file regarding promotion The wording changed here comes from 991bfe11d28a, when the only way to trigger a promotion was with a trigger file. There are more options to achieve this operation these days, like the SQL function pg_promote() or the command `pg_ctl prom

pgsql: doc: Remove reference to trigger file regarding promotion

2023-12-03 Thread Michael Paquier
doc: Remove reference to trigger file regarding promotion The wording changed here comes from 991bfe11d28a, when the only way to trigger a promotion was with a trigger file. There are more options to achieve this operation these days, like the SQL function pg_promote() or the command `pg_ctl prom

pgsql: doc: Remove reference to trigger file regarding promotion

2023-12-03 Thread Michael Paquier
doc: Remove reference to trigger file regarding promotion The wording changed here comes from 991bfe11d28a, when the only way to trigger a promotion was with a trigger file. There are more options to achieve this operation these days, like the SQL function pg_promote() or the command `pg_ctl prom

pgsql: doc: Remove reference to trigger file regarding promotion

2023-12-03 Thread Michael Paquier
doc: Remove reference to trigger file regarding promotion The wording changed here comes from 991bfe11d28a, when the only way to trigger a promotion was with a trigger file. There are more options to achieve this operation these days, like the SQL function pg_promote() or the command `pg_ctl prom

pgsql: doc: Remove reference to trigger file regarding promotion

2023-12-03 Thread Michael Paquier
doc: Remove reference to trigger file regarding promotion The wording changed here comes from 991bfe11d28a, when the only way to trigger a promotion was with a trigger file. There are more options to achieve this operation these days, like the SQL function pg_promote() or the command `pg_ctl prom

pgsql: Add support for REINDEX in event triggers

2023-12-03 Thread Michael Paquier
Add support for REINDEX in event triggers This commit adds support for REINDEX in event triggers, making this command react for the events ddl_command_start and ddl_command_end. The indexes rebuilt are collected with the ReindexStmt emitted by the caller, for the concurrent and non-concurrent pat

pgsql: Remove unnecessary includes of

2023-12-03 Thread Peter Eisentraut
Remove unnecessary includes of These were once needed for sig_atomic_t, but that no longer appears in these headers, so the include is not needed. Reviewed-by: Shubham Khanna Reviewed-by: Tom Lane Discussion: https://www.postgresql.org/message-id/flat/cff5475d-e0a9-4561-b094-794aa36bd031%40ei

pgsql: Remove unnecessary include of

2023-12-03 Thread Peter Eisentraut
Remove unnecessary include of This was put here as part of a mechanical replacement of the old "getaddrinfo.h" with plus (commit 5579388d2d). But here, we only need netdb.h (for NI_MAXHOST), not sys/socket.h. Reviewed-by: Shubham Khanna Reviewed-by: Tom Lane Discussion: https://www.postgre

pgsql: Remove unnecessary include of

2023-12-03 Thread Peter Eisentraut
Remove unnecessary include of This was probably never necessary. (The header used to use random(), but that shouldn't require either. In any case, that's gone, too.) Reviewed-by: Shubham Khanna Reviewed-by: Tom Lane Discussion: https://www.postgresql.org/message-id/flat/cff5475d-e0a9-4561-