FAQ
In pmdie(), we have the following code, which doesn't seem to make
much sense. If the state is PM_RECOVERY at the top of this section it
will get changed to PM_WAIT_BACKENDS and then to PM_WAIT_BACKENDS
again. Either the two "if" statements should be merged (and both bits
should be handled with the same block of code) or the second one
should say "else if". Or at least, I think so...

if (pmState == PM_RECOVERY)
{
/* only bgwriter is active in this state */
pmState = PM_WAIT_BACKENDS;
}
if (pmState == PM_RUN ||
pmState == PM_WAIT_BACKUP ||
pmState == PM_WAIT_READONLY ||
pmState == PM_WAIT_BACKENDS ||
pmState == PM_HOT_STANDBY)
{
ereport(LOG,
(errmsg("aborting any active transactions")));
/* shut down all backends and autovac workers */
SignalSomeChildren(SIGTERM,
BACKEND_TYPE_NORMAL |
BACKEND_TYPE_AUTOVAC); /* and the autovac launcher too
*/
if (AutoVacPID != 0)
signal_child(AutoVacPID, SIGTERM);
/* and the walwriter too */
if (WalWriterPID != 0)
signal_child(WalWriterPID, SIGTERM);
pmState = PM_WAIT_BACKENDS;
}

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

Search Discussions

  • Alvaro Herrera at Jun 22, 2010 at 5:21 pm

    Excerpts from Robert Haas's message of lun jun 21 22:18:46 -0400 2010:
    In pmdie(), we have the following code, which doesn't seem to make
    much sense. If the state is PM_RECOVERY at the top of this section it
    will get changed to PM_WAIT_BACKENDS and then to PM_WAIT_BACKENDS
    again. Either the two "if" statements should be merged (and both bits
    should be handled with the same block of code) or the second one
    should say "else if". Or at least, I think so...
    I'd just move the first block below the second one.

    --
    Álvaro Herrera <alvherre@commandprompt.com>
    The PostgreSQL Company - Command Prompt, Inc.
    PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-hackers @
categoriespostgresql
postedJun 22, '10 at 2:18a
activeJun 22, '10 at 5:21p
posts2
users2
websitepostgresql.org...
irc#postgresql

2 users in discussion

Alvaro Herrera: 1 post Robert Haas: 1 post

People

Translate

site design / logo © 2022 Grokbase