git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 28e4632)
Remove obsolete check in SIGTERM handler for the startup process.
2024年2月14日 23:09:31 +0000 (17:09 -0600)
2024年2月14日 23:09:31 +0000 (17:09 -0600)
Thanks to commit 3b00fdba9f, this check in the SIGTERM handler for
the startup process is now obsolete and can be removed. Instead of
leaving around the dead function write_stderr_signal_safe(), I've
opted to just remove it for now.

This partially reverts commit 97550c0711.

Reviewed-by: Andres Freund, Noah Misch
Discussion: https://postgr.es/m/20231121212008.GA3742740%40nathanxps13


diff --git a/src/backend/postmaster/startup.c b/src/backend/postmaster/startup.c
index b6b53cd25f522f3db559649c8c8f8037e081c6da..44b6c5bb7585b447242a7075a5a65956c22ac61a 100644 (file)
--- a/src/backend/postmaster/startup.c
+++ b/src/backend/postmaster/startup.c
@@ -19,8 +19,6 @@
*/
#include "postgres.h"
-#include <unistd.h>
-
#include "access/xlog.h"
#include "access/xlogrecovery.h"
#include "access/xlogutils.h"
@@ -112,20 +110,7 @@ static void
StartupProcShutdownHandler(SIGNAL_ARGS)
{
if (in_restore_command)
- {
- /*
- * If we are in a child process (e.g., forked by system() in
- * RestoreArchivedFile()), we don't want to call any exit callbacks.
- * The parent will take care of that.
- */
- if (MyProcPid == (int) getpid())
- proc_exit(1);
- else
- {
- write_stderr_signal_safe("StartupProcShutdownHandler() called in child process\n");
- _exit(1);
- }
- }
+ proc_exit(1);
else
shutdown_requested = true;
WakeupRecovery();
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 700fbde6db4185489570e3c18e0deb7ed362916b..bba00a0087f9a494663edb3389e4c8dffae956bd 100644 (file)
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -3737,31 +3737,3 @@ write_stderr(const char *fmt,...)
#endif
va_end(ap);
}
-
-
-/*
- * Write a message to STDERR using only async-signal-safe functions. This can
- * be used to safely emit a message from a signal handler.
- *
- * TODO: It is likely possible to safely do a limited amount of string
- * interpolation (e.g., %s and %d), but that is not presently supported.
- */
-void
-write_stderr_signal_safe(const char *str)
-{
- int nwritten = 0;
- int ntotal = strlen(str);
-
- while (nwritten < ntotal)
- {
- int rc;
-
- rc = write(STDERR_FILENO, str + nwritten, ntotal - nwritten);
-
- /* Just give up on error. There isn't much else we can do. */
- if (rc == -1)
- return;
-
- nwritten += rc;
- }
-}
diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h
index 761ee2512d982283b6b1b26f716e28edc18a3419..054dd2bf62f387709f3f535f67fdd7a0311b7fdf 100644 (file)
--- a/src/include/utils/elog.h
+++ b/src/include/utils/elog.h
@@ -536,10 +536,4 @@ extern void write_jsonlog(ErrorData *edata);
*/
extern void write_stderr(const char *fmt,...) pg_attribute_printf(1, 2);
-/*
- * Write a message to STDERR using only async-signal-safe functions. This can
- * be used to safely emit a message from a signal handler.
- */
-extern void write_stderr_signal_safe(const char *fmt);
-
#endif /* ELOG_H */
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /