mirror of
https://github.com/postgres/postgres.git
synced 2025-12-10 14:22:35 +03:00
Back-port changes of Jan 16 and 17 to "revoke" pending fsync requests during
DROP TABLE and DROP DATABASE. Should prevent unexpected "permission denied" failures on Windows, and is cleaner on other platforms too since we no longer have to take it on faith that ENOENT is okay during an fsync attempt. Patched as far back as 8.1; per recent discussion I think we are not going to worry about Windows-specific issues in 8.0 anymore.
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.187 2006/11/05 22:42:08 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.187.2.1 2007/01/27 20:15:47 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "postmaster/bgwriter.h"
|
||||
#include "storage/freespace.h"
|
||||
#include "storage/procarray.h"
|
||||
#include "storage/smgr.h"
|
||||
#include "utils/acl.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/flatfiles.h"
|
||||
@@ -643,6 +644,12 @@ dropdb(const char *dbname, bool missing_ok)
|
||||
*/
|
||||
FreeSpaceMapForgetDatabase(db_id);
|
||||
|
||||
/*
|
||||
* Tell bgwriter to forget any pending fsync requests for files in the
|
||||
* database; else it'll fail at next checkpoint.
|
||||
*/
|
||||
ForgetDatabaseFsyncRequests(db_id);
|
||||
|
||||
/*
|
||||
* On Windows, force a checkpoint so that the bgwriter doesn't hold any
|
||||
* open files, which would cause rmdir() to fail.
|
||||
|
||||
Reference in New Issue
Block a user