提交 d18643c4 编写于 作者: T Tom Lane

Shift the responsibility for emitting "database system is shut down".

Historically this message has been emitted at the end of ShutdownXLOG().
That's not an insane place for it in a standalone backend, but in the
postmaster environment we've grown a fair amount of stuff that happens
later, including archiver/walsender shutdown, stats collector shutdown,
etc.  Recent buildfarm experimentation showed that on slower machines
there could be many seconds' delay between finishing ShutdownXLOG() and
actual postmaster exit.  That's fairly confusing, both for testing
purposes and for DBAs.  Hence, move the code that prints this message
into UnlinkLockFiles(), so that it comes out just after we remove the
postmaster's pidfile.  That is a more appropriate definition of "is shut
down" from the point of view of "pg_ctl stop", for example.  In general,
removing the pidfile should be the last externally-visible action of
either a postmaster or a standalone backend; compare commit
d73d14c2 for instance.  So this seems
like a reasonably future-proof approach.
上级 c319991b
......@@ -7948,10 +7948,6 @@ ShutdownXLOG(int code, Datum arg)
ShutdownCommitTs();
ShutdownSUBTRANS();
ShutdownMultiXact();
/* Don't be chatty in standalone mode */
ereport(IsPostmasterEnvironment ? LOG : NOTICE,
(errmsg("database system is shut down")));
}
/*
......
......@@ -724,6 +724,17 @@ UnlinkLockFiles(int status, Datum arg)
}
/* Since we're about to exit, no need to reclaim storage */
lock_files = NIL;
/*
* Lock file removal should always be the last externally visible action
* of a postmaster or standalone backend, while we won't come here at all
* when exiting postmaster child processes. Therefore, this is a good
* place to log completion of shutdown. We could alternatively teach
* proc_exit() to do it, but that seems uglier. In a standalone backend,
* use NOTICE elevel to be less chatty.
*/
ereport(IsPostmasterEnvironment ? LOG : NOTICE,
(errmsg("database system is shut down")));
}
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册