On Thu, Mar 14, 2019 at 11:05 AM Thomas Munro <thomas.mu...@gmail.com> wrote:
> I renamed the CVs because the names I had used before broke the
> convention that variables named ckpt_* are protected by ckpt_lck, and
> pushed.

Erm... this made successful checkpoints slightly faster but failed
checkpoints infinitely slower.  It would help if we woke up CV waiters
in the error path too.  Patch attached.

-- 
Thomas Munro
https://enterprisedb.com
From b6ad979bf2280eee1b0fbbe4c13eaefeb82743c8 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.mu...@gmail.com>
Date: Fri, 5 Apr 2019 21:43:29 +1300
Subject: [PATCH] Wake up interested backends when a checkpoint fails.

Commit c6c9474a switched to condition variables instead of sleep
loops to notify backends of checkpoint start and stop, but forgot
to broadcast in case of checkpoint failure.

Author: Thomas Munro
Discussion:
---
 src/backend/postmaster/checkpointer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c
index d303ce3679..a1e04239ad 100644
--- a/src/backend/postmaster/checkpointer.c
+++ b/src/backend/postmaster/checkpointer.c
@@ -279,6 +279,8 @@ CheckpointerMain(void)
 			CheckpointerShmem->ckpt_done = CheckpointerShmem->ckpt_started;
 			SpinLockRelease(&CheckpointerShmem->ckpt_lck);
 
+			ConditionVariableBroadcast(&CheckpointerShmem->done_cv);
+
 			ckpt_active = false;
 		}
 
-- 
2.21.0

Reply via email to