summaryrefslogtreecommitdiff
path: root/src/backend/postmaster/Makefile
AgeCommit message (Collapse)Author
2024-11-14Assign a child slot to every postmaster child processHeikki Linnakangas
Previously, only backends, autovacuum workers, and background workers had an entry in the PMChildFlags array. With this commit, all postmaster child processes, including all the aux processes, have an entry. Dead-end backends still don't get an entry, though, and other processes that don't touch shared memory will never mark their PMChildFlags entry as active. We now maintain separate freelists for different kinds of child processes. That ensures that there are always slots available for autovacuum and background workers. Previously, pre-authentication backends could prevent autovacuum or background workers from starting up, by using up all the slots. The code to manage the slots in the postmaster process is in a new pmchild.c source file. Because postmaster.c is just so large. Assigning pmsignal slot numbers is now pmchild.c's responsibility. This replaces the PMChildInUse array in pmsignal.c. Some of the comments in postmaster.c still talked about the "stats process", but that was removed in commit 5891c7a8ed. Fix those while we're at it. Reviewed-by: Andres Freund <[email protected]> Discussion: https://www.postgresql.org/message-id/[email protected]
2024-03-18Move some functions from postmaster.c to a new source fileHeikki Linnakangas
This just moves the functions, with no other changes, to make the next commits smaller and easier to review. The moved functions are related to launching postmaster child processes in EXEC_BACKEND mode. Reviewed-by: Tristan Partin, Andres Freund Discussion: https://www.postgresql.org/message-id/[email protected]
2023-12-20Add a new WAL summarizer process.Robert Haas
When active, this process writes WAL summary files to $PGDATA/pg_wal/summaries. Each summary file contains information for a certain range of LSNs on a certain TLI. For each relation, it stores a "limit block" which is 0 if a relation is created or destroyed within a certain range of WAL records, or otherwise the shortest length to which the relation was truncated during that range of WAL records, or otherwise InvalidBlockNumber. In addition, it stores a list of blocks which have been modified during that range of WAL records, but excluding blocks which were removed by truncation after they were modified and never subsequently modified again. In other words, it tells us which blocks need to copied in case of an incremental backup covering that range of WAL records. But this doesn't yet add the capability to actually perform an incremental backup; the next patch will do that. A new parameter summarize_wal enables or disables this new background process. The background process also automatically deletes summary files that are older than wal_summarize_keep_time, if that parameter has a non-zero value and the summarizer is configured to run. Patch by me, with some design help from Dilip Kumar and Andres Freund. Reviewed by Matthias van de Meent, Dilip Kumar, Jakub Wartak, Peter Eisentraut, and Álvaro Herrera. Discussion: http://postgr.es/m/CA+TgmoYOYZfMCyOXFyC-P+-mdrZqm5pP2N7S-r0z3_402h9rsA@mail.gmail.com
2023-02-17Redesign archive modulesMichael Paquier
A new callback named startup_cb, called shortly after a module is loaded, is added. This makes possible the initialization of any additional state data required by a module. This initial state data can be saved in a ArchiveModuleState, that is now passed down to all the callbacks that can be defined in a module. With this design, it is possible to have a per-module state, aimed at opening the door to the support of more than one archive module. The initialization of the callbacks is changed so as _PG_archive_module_init() does not anymore give in input a ArchiveModuleCallbacks that a module has to fill in with callback definitions. Instead, a module now needs to return a const ArchiveModuleCallbacks. All the structure and callback definitions of archive modules are moved into their own header, named archive_module.h, from pgarch.h. Command-based archiving follows the same line, with a new set of files named shell_archive.{c,h}. There are a few more items that are under discussion to improve the design of archive modules, like the fact that basic_archive calls sigsetjmp() by itself to define its own error handling flow. These will be adjusted later, the changes done here cover already a good portion of what has been discussed. Any modules created for v15 will need to be adjusted to this new design. Author: Nathan Bossart Reviewed-by: Andres Freund Discussion: https://postgr.es/m/[email protected]
2022-04-07pgstat: move pgstat.c to utils/activity.Andres Freund
Now that pgstat is not related to postmaster anymore, src/backend/postmaster is not a well fitting directory. Author: Andres Freund <[email protected]> Discussion: https://postgr.es/m/[email protected]
2022-01-28Move the code to archive files via the shell to a separate file.Robert Haas
This is preparatory work for allowing more extensibility in this area. Nathan Bossart Discussion: http://postgr.es/m/[email protected]
2021-08-05process startup: Move AuxiliaryProcessMain into its own file.Andres Freund
After the preceding commits the auxprocess code is independent from bootstrap.c - so a dedicated file seems less confusing. Author: Andres Freund <[email protected]> Reviewed-By: Kyotaro Horiguchi <[email protected]> Reviewed-By: Robert Haas <[email protected]> Discussion: https://postgr.es/m/[email protected]
2019-12-17Partially deduplicate interrupt handling for background processes.Robert Haas
Where possible, share signal handler code and main loop interrupt checking. This saves quite a bit of code and should simplify maintenance, too. This commit intends not to change the way anything works, even though that might allow more code to be unified. It does unify a bunch of individual variables into a ShutdownRequestPending flag that has is now used by a bunch of different process types, though. Patch by me, reviewed by Andres Freund and Daniel Gustafsson. Discussion: http://postgr.es/m/CA+TgmoZwDk=BguVDVa+qdA6SBKef=PKbaKDQALTC_9qoz1mJqg@mail.gmail.com
2019-11-05Split all OBJS style lines in makefiles into one-line-per-entry style.Andres Freund
When maintaining or merging patches, one of the most common sources for conflicts are the list of objects in makefiles. Especially when the split across lines has been changed on both sides, which is somewhat common due to attempting to stay below 80 columns, those conflicts are unnecessarily laborious to resolve. By splitting, and alphabetically sorting, OBJS style lines into one object per line, conflicts should be less frequent, and easier to resolve when they still occur. Author: Andres Freund Discussion: https://postgr.es/m/[email protected]
2018-04-09Revert "Allow on-line enabling and disabling of data checksums"Magnus Hagander
This reverts the backend sides of commit 1fde38beaa0c3e66c340efc7cc0dc272d6254bb0. I have, at least for now, left the pg_verify_checksums tool in place, as this tool can be very valuable without the rest of the patch as well, and since it's a read-only tool that only runs when the cluster is down it should be a lot safer.
2018-04-05Allow on-line enabling and disabling of data checksumsMagnus Hagander
This makes it possible to turn checksums on in a live cluster, without the previous need for dump/reload or logical replication (and to turn it off). Enabling checkusm starts a background process in the form of a launcher/worker combination that goes through the entire database and recalculates checksums on each and every page. Only when all pages have been checksummed are they fully enabled in the cluster. Any failure of the process will revert to checksums off and the process has to be started. This adds a new WAL record that indicates the state of checksums, so the process works across replicated clusters. Authors: Magnus Hagander and Daniel Gustafsson Review: Tomas Vondra, Michael Banck, Heikki Linnakangas, Andrey Borodin
2013-07-16Allow background workers to be started dynamically.Robert Haas
There is a new API, RegisterDynamicBackgroundWorker, which allows an ordinary user backend to register a new background writer during normal running. This means that it's no longer necessary for all background workers to be registered during processing of shared_preload_libraries, although the option of registering workers at that time remains available. When a background worker exits and will not be restarted, the slot previously used by that background worker is automatically released and becomes available for reuse. Slots used by background workers that are configured for automatic restart can't (yet) be released without shutting down the system. This commit adds a new source file, bgworker.c, and moves some of the existing control logic for background workers there. Previously, there was little enough logic that it made sense to keep everything in postmaster.c, but not any more. This commit also makes the worker_spi contrib module into an extension and adds a new function, worker_spi_launch, which can be used to demonstrate the new facility.
2011-11-02Refactor xlog.c to create src/backend/postmaster/startup.cSimon Riggs
Startup process now has its own dedicated file, just like all other special/background processes. Reduces role and size of xlog.c
2011-11-01Split work of bgwriter between 2 processes: bgwriter and checkpointer.Simon Riggs
bgwriter is now a much less important process, responsible for page cleaning duties only. checkpointer is now responsible for checkpoints and so has a key role in shutdown. Later patches will correct doc references to the now old idea that bgwriter performs checkpoints. Has beneficial effect on performance at high write rates, but mainly refactoring to more easily allow changes for power reduction by simplifying previously tortuous code around required to allow page cleaning and checkpointing to time slice in the same process. Patch by me, Review by Dickson Guedes
2010-09-20Remove cvs keywords from all files.Magnus Hagander
2008-02-19Refactor backend makefiles to remove lots of duplicate codePeter Eisentraut
2007-07-24Create a new dedicated Postgres process, "wal writer", which exists to writeTom Lane
and fsync WAL at convenient intervals. For the moment it just tries to offload this work from backends, but soon it will be responsible for guaranteeing a maximum delay before asynchronously-committed transactions will be flushed to disk. This is a portion of Simon Riggs' async-commit patch, committed to CVS separately because a background WAL writer seems like it might be a good idea independently of the async-commit feature. I rebased walwriter.c on bgwriter.c because it seemed like a more appropriate way of handling signals; while the startup/shutdown logic in postmaster.c is more like autovac because we want walwriter to quit before we start the shutdown checkpoint.
2007-01-20Remove remains of old depend target.Peter Eisentraut
2005-07-14Integrate autovacuum functionality into the backend. There's still aTom Lane
few loose ends to be dealt with, but it seems to work. Alvaro Herrera, based on the contrib code by Matthew O'Connor.
2005-03-10Refactor fork()-related code. We need to do various housekeeping tasksNeil Conway
before we can invoke fork() -- flush stdio buffers, save and restore the profiling timer on Linux with LINUX_PROFILE, and handle BeOS stuff. This patch moves that code into a single function, fork_process(), instead of duplicating it at the various callsites of fork(). This patch doesn't address the EXEC_BACKEND case; there is room for further cleanup there.
2004-08-05Create a built-in log rotation program, so that we no longer have toTom Lane
recommend that people go get Apache's rotatelogs program. Additional benefits are that configuration is done through GUC, rather than externally, and that the postmaster can monitor the log rotator and restart it after failure (though we certainly hope that won't happen often). Andreas Pflug, some rework by Tom Lane.
2004-07-21Back out pg_autovacuum commit after cvs clean failure causes commit.Bruce Momjian
2004-07-21lease find enclosed a patch that matches the PL/Perl documentationBruce Momjian
(fairly closely, I hope) to the current PL/Perl implementation. David Fetter
2004-07-19XLOG file archiving and point-in-time recovery. There are still someTom Lane
loose ends and a glaring lack of documentation, but it basically works. Simon Riggs with some editorialization by Tom Lane.
2004-05-29Separate out bgwriter code into a logically separate module, ratherTom Lane
than being random pieces of other files. Give bgwriter responsibility for all checkpoint activity (other than a post-recovery checkpoint); so this child process absorbs the functionality of the former transient checkpoint and shutdown subprocesses. While at it, create an actual include file for postmaster.c, which for some reason never had its own file before.
2003-11-29$Header: -> $PostgreSQL Changes ...PostgreSQL Daemon
2001-06-22Statistical system views (yet without the config stuff, butJan Wieck
it's hard to keep such massive changes in sync with the tree so I need to get it in and work from there now). Jan
2000-08-31Fix relative path references so that make knowns which dependencies referPeter Eisentraut
to one another. Sort out builddir vs srcdir variable namings. Remove some now obsoleted make variables.
2000-05-29Generated header files parse.h and fmgroids.h are now copied intoTom Lane
the src/include tree, so that -I backend is no longer necessary anywhere. Also, clean up some bit rot in contrib tree.
1999-12-13New LDOUT makefile variable for QNX os.Bruce Momjian
1999-12-09Make LD -r as macros that can be changed for QNX.Bruce Momjian
1998-04-06Hi,Bruce Momjian
Attached you'll find a (big) patch that fixes make dep and make depend in all Makefiles where I found it to be appropriate. It also removes the dependency in Makefile.global for NAMEDATALEN and OIDNAMELEN by making backend/catalog/genbki.sh and bin/initdb/initdb.sh a little smarter. This no longer requires initdb.sh that is turned into initdb with a sed script when installing Postgres, hence initdb.sh should be renamed to initdb (after the patch has been applied :-) ) This patch is against the 6.3 sources, as it took a while to complete. Please review and apply, Cheers, Jeroen van Vianen
1997-12-20Major cleanout of PORTNAME variables from Makefiles...bound to screw upMarc G. Fournier
some of the ports...
1997-12-19More cleanups. I can now compile without PORTNAME being defined nMarc G. Fournier
Makefile.global. End result, if all goes well, should allow for much easier porting, since there will no longer be a concept of a "port". Most, if not everything, *should* be determined by configure, or by the compiler itself. Still work to be done though :)
1997-04-02From: Oleg Bartunov <[email protected]>Marc G. Fournier
Subject: [HACKERS] locale patches ! Hi there, here are little patches to get Postgres 6.1 works with locale stuff. This is a patch against 970402.tar.gz, there are no problem to apply them by hand to 6.0 release. Collate stuff tested about 1-2 months in real working database but I'm sure there must be no problem. US hackers could vote against locale implementation ( locale for sure will affect to speed of postgres ), so I introduce variable USE_LOCALE which controls locale stuff. Non-US users now could use ~* operator for searching and <order by> for strings with nation alphabet. Please, don't forget, as I did first time, to set environment variable LC_CTYPE and LC_COLLATE because backend get locale information from them. I start postmaster from a little script, assuming that shell is Bash shell it looks like: #!/bin/sh export LC_CTYPE=koi8-r export LC_COLLATE=koi8-r postmaster -B 1024 -S -D/usr/local/pgsql/data/ -o '-Fe'
1996-12-28Here's the final set of patches to 6.0 (sup'd on 27/12/96) that allow a fullBruce Momjian
gmake of the code without interruption. There's also some tidy-up of the MAXPATHLEN stuff based on the assumption that all supported platforms have MAXPATHLEN defined in <sys/param.h>. (The only unknowns for the above are AIX and IRIX5.)
1996-11-09Makefile cleanup after reorganizationBruce Momjian
1996-11-03Clean up Makefile, make sure that postmaster.c compilesMarc G. Fournier
1996-10-27Simplify make files, add full dependencies.Bryan Henderson