Rethink PROCSIGNAL_BARRIER_SMGRRELEASE.
Thomas Munro <tmunro@postgresql.org>
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@anarazel.de> Reviewed-by: Robert Haas <robertmhaas@gmail.com> Discussion: https://postgr.es/m/20220209220004.kb3dgtn2x2k2gtdm%40alap3.anarazel.de
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/storage/smgr/md.c | modified | +13 −9 |
| src/backend/storage/smgr/smgr.c | modified | +37 −8 |
| src/include/storage/md.h | modified | +0 −1 |
| src/include/storage/smgr.h | modified | +2 −0 |
Discussion
- wrong fds used for refilenodes after pg_upgrade relfilenode changes Reply-To: 39 messages · 2022-02-09 → 2022-05-14