Have walsenders participate in procsignal infrastructure.
authorAndres Freund
Tue, 6 Jun 2017 01:53:42 +0000 (18:53 -0700)
committerAndres Freund
Tue, 6 Jun 2017 02:18:16 +0000 (19:18 -0700)
The non-participation in procsignal was a problem for both changes in
master, e.g. parallelism not working for normal statements run in
walsender backends, and older branches, e.g. recovery conflicts and
catchup interrupts not working for logical decoding walsenders.

This commit thus replaces the previous WalSndXLogSendHandler with
procsignal_sigusr1_handler.  In branches since db0f6cad48 that can
lead to additional SetLatch calls, but that only rarely seems to make
a difference.

Author: Andres Freund
Reviewed-By: Michael Paquier
Discussion: https://postgr.es/m/20170421014030[email protected]
Backpatch: 9.4, earlier commits don't seem to benefit sufficiently

src/backend/replication/walsender.c

index 96ad33ea831f8d649c9902cad6079db47c03374a..246dfa9c8bd4e33eb052533876bc91df522a243f 100644 (file)
@@ -184,7 +184,6 @@ static XLogRecPtr logical_startptr = InvalidXLogRecPtr;
 
 /* Signal handlers */
 static void WalSndSigHupHandler(SIGNAL_ARGS);
-static void WalSndXLogSendHandler(SIGNAL_ARGS);
 static void WalSndLastCycleHandler(SIGNAL_ARGS);
 
 /* Prototypes for private functions */
@@ -2581,17 +2580,6 @@ WalSndSigHupHandler(SIGNAL_ARGS)
    errno = save_errno;
 }
 
-/* SIGUSR1: set flag to send WAL records */
-static void
-WalSndXLogSendHandler(SIGNAL_ARGS)
-{
-   int         save_errno = errno;
-
-   latch_sigusr1_handler();
-
-   errno = save_errno;
-}
-
 /* SIGUSR2: set flag to do a last cycle and shut down afterwards */
 static void
 WalSndLastCycleHandler(SIGNAL_ARGS)
@@ -2626,7 +2614,7 @@ WalSndSignals(void)
    pqsignal(SIGQUIT, quickdie);    /* hard crash time */
    InitializeTimeouts();       /* establishes SIGALRM handler */
    pqsignal(SIGPIPE, SIG_IGN);
-   pqsignal(SIGUSR1, WalSndXLogSendHandler);   /* request WAL sending */
+   pqsignal(SIGUSR1, procsignal_sigusr1_handler);
    pqsignal(SIGUSR2, WalSndLastCycleHandler);  /* request a last cycle and
                                                 * shutdown */