Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd18643c

Browse files
committed
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 thepostmaster environment we've grown a fair amount of stuff that happenslater, including archiver/walsender shutdown, stats collector shutdown,etc. Recent buildfarm experimentation showed that on slower machinesthere could be many seconds' delay between finishing ShutdownXLOG() andactual postmaster exit. That's fairly confusing, both for testingpurposes and for DBAs. Hence, move the code that prints this messageinto UnlinkLockFiles(), so that it comes out just after we remove thepostmaster's pidfile. That is a more appropriate definition of "is shutdown" from the point of view of "pg_ctl stop", for example. In general,removing the pidfile should be the last externally-visible action ofeither a postmaster or a standalone backend; compare commitd73d14c for instance. So this seemslike a reasonably future-proof approach.
1 parentc319991 commitd18643c

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

‎src/backend/access/transam/xlog.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7948,10 +7948,6 @@ ShutdownXLOG(int code, Datum arg)
79487948
ShutdownCommitTs();
79497949
ShutdownSUBTRANS();
79507950
ShutdownMultiXact();
7951-
7952-
/* Don't be chatty in standalone mode */
7953-
ereport(IsPostmasterEnvironment ?LOG :NOTICE,
7954-
(errmsg("database system is shut down")));
79557951
}
79567952

79577953
/*

‎src/backend/utils/init/miscinit.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,17 @@ UnlinkLockFiles(int status, Datum arg)
724724
}
725725
/* Since we're about to exit, no need to reclaim storage */
726726
lock_files=NIL;
727+
728+
/*
729+
* Lock file removal should always be the last externally visible action
730+
* of a postmaster or standalone backend, while we won't come here at all
731+
* when exiting postmaster child processes. Therefore, this is a good
732+
* place to log completion of shutdown. We could alternatively teach
733+
* proc_exit() to do it, but that seems uglier. In a standalone backend,
734+
* use NOTICE elevel to be less chatty.
735+
*/
736+
ereport(IsPostmasterEnvironment ?LOG :NOTICE,
737+
(errmsg("database system is shut down")));
727738
}
728739

729740
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp