mirror of
https://github.com/postgres/postgres.git
synced 2025-10-15 05:46:52 +03:00
Move the responsibility for calling StartupXLOG into InitPostgres, for
those process types that go through InitPostgres; in particular, bootstrap and standalone-backend cases. This ensures that we have set up a PGPROC and done some other basic initialization steps (corresponding to the if (IsUnderPostmaster) block in AuxiliaryProcessMain) before we attempt to run WAL recovery in a standalone backend. As was discovered last September, this is necessary for some corner-case code paths during WAL recovery, particularly end-of-WAL cleanup. Moving the bootstrap case here too is not necessary for correctness, but it seems like a good idea since it reduces the number of distinct code paths.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.592 2010/03/21 00:17:58 petere Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.593 2010/04/20 01:38:52 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* this is the "main" module of the postgres backend and
|
||||
@@ -3531,11 +3531,7 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
|
||||
PG_SETMASK(&BlockSig); /* block everything except SIGQUIT */
|
||||
|
||||
if (IsUnderPostmaster)
|
||||
{
|
||||
BaseInit();
|
||||
}
|
||||
else
|
||||
if (!IsUnderPostmaster)
|
||||
{
|
||||
/*
|
||||
* Validate we have been given a reasonable-looking DataDir (if under
|
||||
@@ -3551,17 +3547,11 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
* Create lockfile for data directory.
|
||||
*/
|
||||
CreateDataDirLockFile(false);
|
||||
|
||||
BaseInit();
|
||||
|
||||
/*
|
||||
* Start up xlog for standalone backend, and register to have it
|
||||
* closed down at exit.
|
||||
*/
|
||||
StartupXLOG();
|
||||
on_shmem_exit(ShutdownXLOG, 0);
|
||||
}
|
||||
|
||||
/* Early initialization */
|
||||
BaseInit();
|
||||
|
||||
/*
|
||||
* Create a per-backend PGPROC struct in shared memory, except in the
|
||||
* EXEC_BACKEND case where this was done in SubPostmasterMain. We must do
|
||||
|
Reference in New Issue
Block a user