From a59c1c634e162c5cc5eadeebe61d5ab0493cb188 Mon Sep 17 00:00:00 2001 From: Brian Cloutier Date: Wed, 4 Apr 2018 18:12:40 +0000 Subject: [PATCH] Fix cancellation of real time queries Without this change multi_real_time_transaction blocks forever (on Windows) in the block where it repeatedly calls pg_advisory_lock(15). This happens because the deadlock detector tries to cancel the backend but the backend never processes that signal. --- .../distributed/executor/multi_real_time_executor.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/backend/distributed/executor/multi_real_time_executor.c b/src/backend/distributed/executor/multi_real_time_executor.c index 067d101d3..3808b256c 100644 --- a/src/backend/distributed/executor/multi_real_time_executor.c +++ b/src/backend/distributed/executor/multi_real_time_executor.c @@ -199,6 +199,16 @@ MultiRealTimeExecute(Job *job) { MultiClientWait(waitInfo); } + +#ifdef WIN32 + + /* + * Don't call CHECK_FOR_INTERRUPTS because we want to clean up after ourselves, + * calling pgwin32_dispatch_queued_signals sets QueryCancelPending so we leave + * the loop. + */ + pgwin32_dispatch_queued_signals(); +#endif } MultiClientFreeWaitInfo(waitInfo);