pgsql: Rethink PROCSIGNAL_BARRIER_SMGRRELEASE.

From: Thomas Munro <tmunro(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Rethink PROCSIGNAL_BARRIER_SMGRRELEASE.
Date: 2022-05-07 04:52:28
Message-ID: E1nnCQd-000NTM-I7@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Rethink PROCSIGNAL_BARRIER_SMGRRELEASE.

With sufficiently bad luck, it was possible for IssuePendingWritebacks()
to reopen a file after we'd processed PROCSIGNAL_BARRIER_SMGRRELEASE and
before the file was unlinked by some other backend. That left a small
hole in commit 4eb21763's plan to fix all spurious errors from DROP
TABLESPACE and similar on Windows.

Fix by closing md.c's segments, instead of just closing fd.c's
descriptors, and then teaching smgrwriteback() not to open files that
aren't already open.

Reported-by: Andres Freund <andres(at)anarazel(dot)de>
Reviewed-by: Robert Haas <robertmhaas(at)gmail(dot)com>
Discussion: https://postgr.es/m/20220209220004.kb3dgtn2x2k2gtdm%40alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b74e94dc27fdbb13954f230b1d1298430afa6c0c

Modified Files
--------------
src/backend/storage/smgr/md.c | 22 +++++++++++---------
src/backend/storage/smgr/smgr.c | 45 +++++++++++++++++++++++++++++++++--------
src/include/storage/md.h | 1 -
src/include/storage/smgr.h | 2 ++
4 files changed, 52 insertions(+), 18 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Noah Misch 2022-05-07 07:46:40 pgsql: Under has_wal_read_bug, skip contrib/bloom/t/001_wal.pl.
Previous Message Michael Paquier 2022-05-07 00:13:48 Re: pgsql: Remove command checks in tests of pg_basebackup and pg_receivewa