From b80a87c898ac0da9841c4b14eb789bc4670a2c20 Mon Sep 17 00:00:00 2001 From: Craig Ringer Date: Thu, 16 Apr 2015 16:09:24 +0800 Subject: [PATCH] The apply worker wasn't checking for postmaster death when paused Fixes #58 --- bdr_apply.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bdr_apply.c b/bdr_apply.c index 826fd3b857..d6a653f710 100644 --- a/bdr_apply.c +++ b/bdr_apply.c @@ -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); } -- 2.39.5