Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc4d360d

Browse files
committed
Use just one database connection in the "tablespace" test.
On Windows, DROP TABLESPACE has a race condition when run concurrentlywith other processes having opened files in the tablespace. This led toa rare failure on buildfarm member frogmouth. Back-patch to 9.4, wherethe reconnection was introduced.
1 parent8fb4218 commitc4d360d

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

‎src/backend/commands/tablespace.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,13 @@ DropTableSpace(DropTableSpaceStmt *stmt)
491491
* but we can't tell them apart from important data files that we
492492
* mustn't delete. So instead, we force a checkpoint which will clean
493493
* out any lingering files, and try again.
494+
*
495+
* XXX On Windows, an unlinked file persists in the directory listing
496+
* until no process retains an open handle for the file. The DDL
497+
* commands that schedule files for unlink send invalidation messages
498+
* directing other PostgreSQL processes to close the files. DROP
499+
* TABLESPACE should not give up on the tablespace becoming empty
500+
* until all relevant invalidation processing is complete.
494501
*/
495502
RequestCheckpoint(CHECKPOINT_IMMEDIATE |CHECKPOINT_FORCE |CHECKPOINT_WAIT);
496503
if (!destroy_tablespace_directories(tablespaceoid, false))

‎src/test/regress/input/tablespace.source

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ ALTER TABLESPACE testspace OWNER TO tablespace_testuser1;
7171

7272
SET SESSION ROLE tablespace_testuser2;
7373
CREATE TABLE tablespace_table (i int) TABLESPACE testspace; -- fail
74-
75-
\c -
74+
RESET ROLE;
7675

7776
ALTER TABLESPACE testspace RENAME TO testspace_renamed;
7877

‎src/test/regress/output/tablespace.source

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ ALTER TABLESPACE testspace OWNER TO tablespace_testuser1;
9191
SET SESSION ROLE tablespace_testuser2;
9292
CREATE TABLE tablespace_table (i int) TABLESPACE testspace; -- fail
9393
ERROR: permission denied for tablespace testspace
94-
\c -
94+
RESET ROLE;
9595
ALTER TABLESPACE testspace RENAME TO testspace_renamed;
9696
ALTER TABLE ALL IN TABLESPACE testspace_renamed SET TABLESPACE pg_default;
9797
ALTER INDEX ALL IN TABLESPACE testspace_renamed SET TABLESPACE pg_default;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp