pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Munro <tmunro@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix DROP {DATABASE,TABLESPACE} on Windows.
Date: Fri, 11 Feb 2022 21:21:40 +0000
Message-ID: <E1nIdMK-00084g-9s@gemulon.postgresql.org> (raw)

Fix DROP {DATABASE,TABLESPACE} on Windows.

Previously, it was possible for DROP DATABASE, DROP TABLESPACE and ALTER
DATABASE SET TABLESPACE to fail because other backends still had file
handles open for dropped tables.  Windows won't allow a directory
containing unlinked-but-still-open files to be unlinked.  Tackle this
problem by forcing all backends to close all smgr fds.  No change for
Unix systems, which don't suffer from the problem, but the new code path
can be tested by Unix-based developers by defining
USE_BARRIER_SMGRRELEASE explicitly.

It's possible that PROCSIGNAL_BARRIER_SMGRRELEASE will have more
bug-fixing applications soon (under discussion).  Note that this is the
first user of the ProcSignalBarrier mechanism from commit 16a4e4aec.  It
could in principle be back-patched as far as 14, but since field
complaints are rare and ProcSignalBarrier hasn't been battle-tested,
that seems like a bad idea.  Fix in master only, where these failures
have started to show up in automated testing due to new tests.

Suggested-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Discussion: https://postgr.es/m/CA+hUKGLdemy2gBm80kz20GTe6hNVwoErE8KwcJk6-U56oStjtg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4eb2176318d0561846c1f9fb3c68bede799d640f

Modified Files
--------------
src/backend/commands/dbcommands.c    | 19 ++++++++++++++++---
src/backend/commands/tablespace.c    | 26 ++++++++++++++++++++------
src/backend/storage/ipc/procsignal.c | 24 +++---------------------
src/backend/storage/smgr/md.c        |  6 ++++++
src/backend/storage/smgr/smgr.c      | 18 ++++++++++++++++++
src/include/pg_config_manual.h       | 11 +++++++++++
src/include/storage/md.h             |  1 +
src/include/storage/procsignal.h     |  7 +------
src/include/storage/smgr.h           |  1 +
9 files changed, 77 insertions(+), 36 deletions(-)



Message-ID: <E1nIdMK-00084g-9s@gemulon.postgresql.org>
Permalink:  ../E1nIdMK-00084g-9s@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1nIdMK-00084g-9s@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tmunro@postgresql.org
  Subject: Re: pgsql: Fix DROP {DATABASE,TABLESPACE} on Windows.
  In-Reply-To: <E1nIdMK-00084g-9s@gemulon.postgresql.org>
  References: <E1nIdMK-00084g-9s@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox