From e9707dfde25eaa9c447032c4b5a61e3011141dc9 Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Wed, 16 Feb 2022 09:26:08 -0800 Subject: [PATCH v2 1/1] call AbsorbSyncRequests() after indicating checkpoint start --- src/backend/postmaster/checkpointer.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c index 4488e3a443..e93d34b71f 100644 --- a/src/backend/postmaster/checkpointer.c +++ b/src/backend/postmaster/checkpointer.c @@ -401,6 +401,18 @@ CheckpointerMain(void) ConditionVariableBroadcast(&CheckpointerShmem->start_cv); + /* + * Pick up any last minute requests. DROP TABLESPACE schedules a + * checkpoint to clean up any lingering files that are scheduled for + * deletion. If we don't absorb those requests now, they might not + * be absorbed until after incrementing the checkpoint cycle + * counter, so the files won't be deleted until the following + * checkpoint. By absorbing requests after indicating the + * checkpoint has started, operations like DROP TABLESPACE can be + * sure that the next checkpoint will clean up any such files. + */ + AbsorbSyncRequests(); + /* * The end-of-recovery checkpoint is a real checkpoint that's * performed while we're still in recovery. -- 2.25.1