mirror of
https://github.com/postgres/postgres.git
synced 2025-06-29 10:41:53 +03:00
Use standard interrupt handling in logical replication launcher.
Previously the exit handling was only able to exit from within the main loop, and not from within the backend code it calls. Fix that by using the standard die() SIGTERM handler, and adding the necessary CHECK_FOR_INTERRUPTS() call. This requires adding yet another process-type-specific branch to ProcessInterrupts(), which hints that we probably should generalize that handling. But that's work for another day. Author: Petr Jelinek Reviewed-By: Andres Freund Discussion: https://postgr.es/m/fe072153-babd-3b5d-8052-73527a6eb657@2ndquadrant.com
This commit is contained in:
@ -55,6 +55,7 @@
|
||||
#include "pg_getopt.h"
|
||||
#include "postmaster/autovacuum.h"
|
||||
#include "postmaster/postmaster.h"
|
||||
#include "replication/logicallauncher.h"
|
||||
#include "replication/logicalworker.h"
|
||||
#include "replication/slot.h"
|
||||
#include "replication/walsender.h"
|
||||
@ -2848,6 +2849,14 @@ ProcessInterrupts(void)
|
||||
ereport(FATAL,
|
||||
(errcode(ERRCODE_ADMIN_SHUTDOWN),
|
||||
errmsg("terminating logical replication worker due to administrator command")));
|
||||
else if (IsLogicalLauncher())
|
||||
{
|
||||
ereport(DEBUG1,
|
||||
(errmsg("logical replication launcher shutting down")));
|
||||
|
||||
/* The logical replication launcher can be stopped at any time. */
|
||||
proc_exit(0);
|
||||
}
|
||||
else if (RecoveryConflictPending && RecoveryConflictRetryable)
|
||||
{
|
||||
pgstat_report_recovery_conflict(RecoveryConflictReason);
|
||||
|
Reference in New Issue
Block a user