Skip site navigation (1) Skip section navigation (2)

missing "else" in postmaster.c?

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: missing "else" in postmaster.c?
Date: 2010-06-22 02:18:46
Message-ID: AANLkTimK-d9vEBxzqzaFtwTMaZdM1ZkNU9tfP2ExhX3N@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
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

Responses

pgsql-hackers by date

Next:From: Andrew DunstanDate: 2010-06-22 02:38:49
Subject: Re: extensible enum types
Previous:From: Robert HaasDate: 2010-06-22 01:16:22
Subject: Re: Explicit psqlrc

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group