Don't launch new child processes after we've been told to shut down.
Don't launch new child processes after we've been told to shut down.

Once we've received a shutdown signal (SIGINT or SIGTERM), we should not
launch any more child processes, even if we get signals requesting such.
The normal code path for spawning backends has always understood that,
but the postmaster's infrastructure for hot standby and autovacuum didn't
get the memo.  As reported by Hari Babu in bug #7643, this could lead to
failure to shut down at all in some cases, such as when SIGINT is received
just before the startup process sends PMSIGNAL_RECOVERY_STARTED: we'd
launch a bgwriter and checkpointer, and then those processes would have no
idea that they ought to quit.  Similarly, launching a new autovacuum worker
would result in waiting till it finished before shutting down.

Also, switch the order of the code blocks in reaper() that detect startup
process crash versus shutdown termination.  Once we've sent it a signal,
we should not consider that exit(1) is surprising.  This is just a cosmetic
fix since shutdown occurs correctly anyway, but better not to log a phony
complaint about startup process crash.

Back-patch to 9.0.  Some parts of this might be applicable before that,
but given the lack of prior complaints I'm not going to worry too much
about older branches.

jmcatamney/gpdb,pavanvd/postgres-xl,jmcatamney/gpdb,ashwinstar/gpdb,jmcatamney/gpdb,pavanvd/postgres-xl,zeroae/postgres-xl,50wu/gpdb,50wu/gpdb,pavanvd/postgres-xl,lisakowen/gpdb,zeroae/postgres-xl,greenplum-db/gpdb,yazun/postgres-xl,ashwinstar/gpdb,xinzweb/gpdb,yazun/postgres-xl,zeroae/postgres-xl,pavanvd/postgres-xl,adam8157/gpdb,greenplum-db/gpdb,greenplum-db/gpdb,50wu/gpdb,greenplum-db/gpdb,jmcatamney/gpdb,zeroae/postgres-xl,lisakowen/gpdb,oberstet/postgres-xl,jmcatamney/gpdb,Postgres-XL/Postgres-XL,lisakowen/gpdb,xinzweb/gpdb,adam8157/gpdb,ashwinstar/gpdb,ashwinstar/gpdb,ovr/postgres-xl,xinzweb/gpdb,ovr/postgres-xl,50wu/gpdb,greenplum-db/gpdb,yazun/postgres-xl,greenplum-db/gpdb,ovr/postgres-xl,lisakowen/gpdb,oberstet/postgres-xl,ovr/postgres-xl,techdragon/Postgres-XL,yazun/postgres-xl,ashwinstar/gpdb,oberstet/postgres-xl,adam8157/gpdb,50wu/gpdb,adam8157/gpdb,xinzweb/gpdb,adam8157/gpdb,ashwinstar/gpdb,techdragon/Postgres-XL,lisakowen/gpdb,greenplum-db/gpdb,Postgres-XL/Postgres-XL,xinzweb/gpdb,Postgres-XL/Postgres-XL,lisakowen/gpdb,adam8157/gpdb,yazun/postgres-xl,50wu/gpdb,ashwinstar/gpdb,xinzweb/gpdb,greenplum-db/gpdb,xinzweb/gpdb,adam8157/gpdb,pavanvd/postgres-xl,ovr/postgres-xl,50wu/gpdb,jmcatamney/gpdb,Postgres-XL/Postgres-XL,oberstet/postgres-xl,zeroae/postgres-xl,Postgres-XL/Postgres-XL,oberstet/postgres-xl,lisakowen/gpdb,50wu/gpdb,xinzweb/gpdb,ashwinstar/gpdb,adam8157/gpdb,jmcatamney/gpdb,techdragon/Postgres-XL,jmcatamney/gpdb,techdragon/Postgres-XL,lisakowen/gpdb,techdragon/Postgres-XL