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

Commit8fd0498

Browse files
Remove obsolete check in SIGTERM handler for the startup process.
Thanks to commit3b00fdb, this check in the SIGTERM handler forthe startup process is now obsolete and can be removed. Instead ofleaving around the dead function write_stderr_signal_safe(), I'veopted to just remove it for now.This partially reverts commit97550c0.Reviewed-by: Andres Freund, Noah MischDiscussion:https://postgr.es/m/20231121212008.GA3742740%40nathanxps13
1 parent28e4632 commit8fd0498

File tree

3 files changed

+1
-50
lines changed

3 files changed

+1
-50
lines changed

‎src/backend/postmaster/startup.c

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
*/
2020
#include"postgres.h"
2121

22-
#include<unistd.h>
23-
2422
#include"access/xlog.h"
2523
#include"access/xlogrecovery.h"
2624
#include"access/xlogutils.h"
@@ -112,20 +110,7 @@ static void
112110
StartupProcShutdownHandler(SIGNAL_ARGS)
113111
{
114112
if (in_restore_command)
115-
{
116-
/*
117-
* If we are in a child process (e.g., forked by system() in
118-
* RestoreArchivedFile()), we don't want to call any exit callbacks.
119-
* The parent will take care of that.
120-
*/
121-
if (MyProcPid== (int)getpid())
122-
proc_exit(1);
123-
else
124-
{
125-
write_stderr_signal_safe("StartupProcShutdownHandler() called in child process\n");
126-
_exit(1);
127-
}
128-
}
113+
proc_exit(1);
129114
else
130115
shutdown_requested= true;
131116
WakeupRecovery();

‎src/backend/utils/error/elog.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3737,31 +3737,3 @@ write_stderr(const char *fmt,...)
37373737
#endif
37383738
va_end(ap);
37393739
}
3740-
3741-
3742-
/*
3743-
* Write a message to STDERR using only async-signal-safe functions. This can
3744-
* be used to safely emit a message from a signal handler.
3745-
*
3746-
* TODO: It is likely possible to safely do a limited amount of string
3747-
* interpolation (e.g., %s and %d), but that is not presently supported.
3748-
*/
3749-
void
3750-
write_stderr_signal_safe(constchar*str)
3751-
{
3752-
intnwritten=0;
3753-
intntotal=strlen(str);
3754-
3755-
while (nwritten<ntotal)
3756-
{
3757-
intrc;
3758-
3759-
rc=write(STDERR_FILENO,str+nwritten,ntotal-nwritten);
3760-
3761-
/* Just give up on error. There isn't much else we can do. */
3762-
if (rc==-1)
3763-
return;
3764-
3765-
nwritten+=rc;
3766-
}
3767-
}

‎src/include/utils/elog.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -536,10 +536,4 @@ extern void write_jsonlog(ErrorData *edata);
536536
*/
537537
externvoidwrite_stderr(constchar*fmt,...)pg_attribute_printf(1,2);
538538

539-
/*
540-
* Write a message to STDERR using only async-signal-safe functions. This can
541-
* be used to safely emit a message from a signal handler.
542-
*/
543-
externvoidwrite_stderr_signal_safe(constchar*fmt);
544-
545539
#endif/* ELOG_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp