mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-03 17:57:19 +02:00
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.
This commit is contained in:
parent
8fb4218ef4
commit
c4d360d182
@ -491,6 +491,13 @@ DropTableSpace(DropTableSpaceStmt *stmt)
|
|||||||
* but we can't tell them apart from important data files that we
|
* 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
|
* mustn't delete. So instead, we force a checkpoint which will clean
|
||||||
* out any lingering files, and try again.
|
* 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);
|
RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT);
|
||||||
if (!destroy_tablespace_directories(tablespaceoid, false))
|
if (!destroy_tablespace_directories(tablespaceoid, false))
|
||||||
|
@ -71,8 +71,7 @@ ALTER TABLESPACE testspace OWNER TO tablespace_testuser1;
|
|||||||
|
|
||||||
SET SESSION ROLE tablespace_testuser2;
|
SET SESSION ROLE tablespace_testuser2;
|
||||||
CREATE TABLE tablespace_table (i int) TABLESPACE testspace; -- fail
|
CREATE TABLE tablespace_table (i int) TABLESPACE testspace; -- fail
|
||||||
|
RESET ROLE;
|
||||||
\c -
|
|
||||||
|
|
||||||
ALTER TABLESPACE testspace RENAME TO testspace_renamed;
|
ALTER TABLESPACE testspace RENAME TO testspace_renamed;
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ ALTER TABLESPACE testspace OWNER TO tablespace_testuser1;
|
|||||||
SET SESSION ROLE tablespace_testuser2;
|
SET SESSION ROLE tablespace_testuser2;
|
||||||
CREATE TABLE tablespace_table (i int) TABLESPACE testspace; -- fail
|
CREATE TABLE tablespace_table (i int) TABLESPACE testspace; -- fail
|
||||||
ERROR: permission denied for tablespace testspace
|
ERROR: permission denied for tablespace testspace
|
||||||
\c -
|
RESET ROLE;
|
||||||
ALTER TABLESPACE testspace RENAME TO testspace_renamed;
|
ALTER TABLESPACE testspace RENAME TO testspace_renamed;
|
||||||
ALTER TABLE ALL IN TABLESPACE testspace_renamed SET TABLESPACE pg_default;
|
ALTER TABLE ALL IN TABLESPACE testspace_renamed SET TABLESPACE pg_default;
|
||||||
ALTER INDEX ALL IN TABLESPACE testspace_renamed SET TABLESPACE pg_default;
|
ALTER INDEX ALL IN TABLESPACE testspace_renamed SET TABLESPACE pg_default;
|
||||||
|
Loading…
Reference in New Issue
Block a user