mirror of
https://github.com/postgres/postgres.git
synced 2025-11-04 20:11:56 +03:00
Fix old-fd issues using global barriers everywhere.
Commits4eb21763andb74e94dcintroduced a way to force every backend to close all relation files, to fix an ancient Windows-only bug. This commit extends that behavior to all operating systems and adds a couple of extra barrier points, to fix a totally different class of bug: the reuse of relfilenodes in scenarios that have no other kind of cache invalidation to prevent file descriptor mix-ups. In all releases, data corruption could occur when you moved a database to another tablespace and then back again. Despite that, no back-patch for now as the infrastructure required is too new and invasive. In master only, since commitaa010514, it could also happen when using CREATE DATABASE with a user-supplied OID or via pg_upgrade. Author: Andres Freund <andres@anarazel.de> Reviewed-by: Robert Haas <robertmhaas@gmail.com> Reviewed-by: Thomas Munro <thomas.munro@gmail.com> Discussion: https://postgr.es/m/20220209220004.kb3dgtn2x2k2gtdm%40alap3.anarazel.de
This commit is contained in:
@@ -152,17 +152,6 @@
|
||||
#define EXEC_BACKEND
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If USE_BARRIER_SMGRRELEASE is defined, certain code paths that unlink
|
||||
* directories will ask other backends to close all smgr file descriptors.
|
||||
* This is enabled on Windows, because otherwise unlinked but still open files
|
||||
* can prevent rmdir(containing_directory) from succeeding. On other
|
||||
* platforms, it can be defined to exercise those code paths.
|
||||
*/
|
||||
#if defined(WIN32)
|
||||
#define USE_BARRIER_SMGRRELEASE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define this if your operating system supports link()
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user