The apply worker wasn't checking for postmaster death when paused
authorCraig Ringer <craig@2ndquadrant.com>
Thu, 16 Apr 2015 08:09:24 +0000 (16:09 +0800)
committerCraig Ringer <craig@2ndquadrant.com>
Mon, 20 Apr 2015 13:17:54 +0000 (21:17 +0800)
Fixes #58

bdr_apply.c

index 826fd3b857a80bb6d2de374a3596bc42d38b838c..d6a653f7109514d3f8579aff75fd38a1d49d36b1 100644 (file)
@@ -2384,7 +2384,12 @@ bdr_apply_work(PGconn* streamConn)
        while (BdrWorkerCtl->pause_apply && !IsTransactionState())
        {
            ResetLatch(&MyProc->procLatch);
-           rc = WaitLatch(&MyProc->procLatch, WL_TIMEOUT, 1000L);
+           rc = WaitLatch(&MyProc->procLatch,
+                          WL_TIMEOUT | WL_LATCH_SET | WL_POSTMASTER_DEATH,
+                          1000L);
+
+           if (rc & WL_POSTMASTER_DEATH)
+               proc_exit(1);
        }
        MemoryContextResetAndDeleteChildren(MessageContext);
    }