diff options
author | Noah Misch <noah@leadboat.com> | 2014-11-12 07:33:17 -0500 |
---|---|---|
committer | Noah Misch <noah@leadboat.com> | 2014-11-12 07:34:07 -0500 |
commit | c4d360d18259690442036c1ee07a899cbe4022a0 (patch) | |
tree | 74f94cbd5f8491e5eff595e68efba6814a10a1a9 /src | |
parent | 8fb4218ef41da0baff4909c5d74f23513bac9950 (diff) | |
download | postgresql-c4d360d18259690442036c1ee07a899cbe4022a0.tar.gz postgresql-c4d360d18259690442036c1ee07a899cbe4022a0.zip |
Use just one database connection in the "tablespace" test.
On Windows, DROP TABLESPACE has a race condition when run concurrently
with other processes having opened files in the tablespace. This led to
a rare failure on buildfarm member frogmouth. Back-patch to 9.4, where
the reconnection was introduced.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/commands/tablespace.c | 7 | ||||
-rw-r--r-- | src/test/regress/input/tablespace.source | 3 | ||||
-rw-r--r-- | src/test/regress/output/tablespace.source | 2 |
3 files changed, 9 insertions, 3 deletions
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c index 28e69a55510..096d01aaf0b 100644 --- a/src/backend/commands/tablespace.c +++ b/src/backend/commands/tablespace.c @@ -491,6 +491,13 @@ DropTableSpace(DropTableSpaceStmt *stmt) * but we can't tell them apart from important data files that we * mustn't delete. So instead, we force a checkpoint which will clean * out any lingering files, and try again. + * + * XXX On Windows, an unlinked file persists in the directory listing + * until no process retains an open handle for the file. The DDL + * commands that schedule files for unlink send invalidation messages + * directing other PostgreSQL processes to close the files. DROP + * TABLESPACE should not give up on the tablespace becoming empty + * until all relevant invalidation processing is complete. */ RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT); if (!destroy_tablespace_directories(tablespaceoid, false)) diff --git a/src/test/regress/input/tablespace.source b/src/test/regress/input/tablespace.source index e259254b02c..75ec689498f 100644 --- a/src/test/regress/input/tablespace.source +++ b/src/test/regress/input/tablespace.source @@ -71,8 +71,7 @@ ALTER TABLESPACE testspace OWNER TO tablespace_testuser1; SET SESSION ROLE tablespace_testuser2; CREATE TABLE tablespace_table (i int) TABLESPACE testspace; -- fail - -\c - +RESET ROLE; ALTER TABLESPACE testspace RENAME TO testspace_renamed; diff --git a/src/test/regress/output/tablespace.source b/src/test/regress/output/tablespace.source index a30651087b9..ca606508f81 100644 --- a/src/test/regress/output/tablespace.source +++ b/src/test/regress/output/tablespace.source @@ -91,7 +91,7 @@ ALTER TABLESPACE testspace OWNER TO tablespace_testuser1; SET SESSION ROLE tablespace_testuser2; CREATE TABLE tablespace_table (i int) TABLESPACE testspace; -- fail ERROR: permission denied for tablespace testspace -\c - +RESET ROLE; ALTER TABLESPACE testspace RENAME TO testspace_renamed; ALTER TABLE ALL IN TABLESPACE testspace_renamed SET TABLESPACE pg_default; ALTER INDEX ALL IN TABLESPACE testspace_renamed SET TABLESPACE pg_default; |