mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-02 13:41:15 +02:00
Under new theory of operation wherein postmaster forks children
immediately, we will fork a child even if the database state does not permit connections to be accepted (eg, we are in recovery mode). The child process will correctly reject the connection and exit as soon as it's finished collecting the connection request message. However, this means that reaper() must be prepared to see child process exit signals even while it's waiting for startup or shutdown process to finish. As was, a connection request arriving during a database recovery or shutdown would cause postmaster abort.
This commit is contained in:
parent
10e9cd2299
commit
109d50dd35
@ -37,7 +37,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.229 2001/06/29 16:05:57 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.230 2001/07/01 00:06:23 tgl Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
*
|
*
|
||||||
@ -1357,7 +1357,11 @@ pmdie(SIGNAL_ARGS)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ShutdownPID > 0)
|
if (ShutdownPID > 0)
|
||||||
|
{
|
||||||
|
postmaster_error("Shutdown process %d already running",
|
||||||
|
ShutdownPID);
|
||||||
abort();
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
ShutdownPID = ShutdownDataBase();
|
ShutdownPID = ShutdownDataBase();
|
||||||
errno = save_errno;
|
errno = save_errno;
|
||||||
@ -1409,7 +1413,11 @@ pmdie(SIGNAL_ARGS)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ShutdownPID > 0)
|
if (ShutdownPID > 0)
|
||||||
|
{
|
||||||
|
postmaster_error("Shutdown process %d already running",
|
||||||
|
ShutdownPID);
|
||||||
abort();
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
ShutdownPID = ShutdownDataBase();
|
ShutdownPID = ShutdownDataBase();
|
||||||
errno = save_errno;
|
errno = save_errno;
|
||||||
@ -1481,27 +1489,21 @@ reaper(SIGNAL_ARGS)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShutdownPID > 0)
|
if (ShutdownPID > 0 && pid == ShutdownPID)
|
||||||
{
|
{
|
||||||
if (pid != ShutdownPID)
|
|
||||||
abort();
|
|
||||||
if (exitstatus != 0)
|
if (exitstatus != 0)
|
||||||
{
|
{
|
||||||
postmaster_error("Shutdown proc %d exited with status %d", pid, exitstatus);
|
postmaster_error("Shutdown proc %d exited with status %d", pid, exitstatus);
|
||||||
fflush(stderr);
|
|
||||||
ExitPostmaster(1);
|
ExitPostmaster(1);
|
||||||
}
|
}
|
||||||
ExitPostmaster(0);
|
ExitPostmaster(0);
|
||||||
}
|
}
|
||||||
if (StartupPID > 0)
|
if (StartupPID > 0 && pid == StartupPID)
|
||||||
{
|
{
|
||||||
if (pid != StartupPID)
|
|
||||||
abort();
|
|
||||||
if (exitstatus != 0)
|
if (exitstatus != 0)
|
||||||
{
|
{
|
||||||
postmaster_error("Startup proc %d exited with status %d - abort",
|
postmaster_error("Startup proc %d exited with status %d - abort",
|
||||||
pid, exitstatus);
|
pid, exitstatus);
|
||||||
fflush(stderr);
|
|
||||||
ExitPostmaster(1);
|
ExitPostmaster(1);
|
||||||
}
|
}
|
||||||
StartupPID = 0;
|
StartupPID = 0;
|
||||||
@ -1509,7 +1511,11 @@ reaper(SIGNAL_ARGS)
|
|||||||
if (Shutdown > NoShutdown)
|
if (Shutdown > NoShutdown)
|
||||||
{
|
{
|
||||||
if (ShutdownPID > 0)
|
if (ShutdownPID > 0)
|
||||||
|
{
|
||||||
|
postmaster_error("Shutdown process %d already running",
|
||||||
|
ShutdownPID);
|
||||||
abort();
|
abort();
|
||||||
|
}
|
||||||
ShutdownPID = ShutdownDataBase();
|
ShutdownPID = ShutdownDataBase();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1533,7 +1539,6 @@ reaper(SIGNAL_ARGS)
|
|||||||
|
|
||||||
if (FatalError)
|
if (FatalError)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Wait for all children exit, then reset shmem and
|
* Wait for all children exit, then reset shmem and
|
||||||
* StartupDataBase.
|
* StartupDataBase.
|
||||||
|
Loading…
Reference in New Issue
Block a user