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

Commit28245b8

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 parent8339f33 commit28245b8

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
@@ -493,6 +493,13 @@ DropTableSpace(DropTableSpaceStmt *stmt)
493493
* but we can't tell them apart from important data files that we
494494
* mustn't delete. So instead, we force a checkpoint which will clean
495495
* out any lingering files, and try again.
496+
*
497+
* XXX On Windows, an unlinked file persists in the directory listing
498+
* until no process retains an open handle for the file. The DDL
499+
* commands that schedule files for unlink send invalidation messages
500+
* directing other PostgreSQL processes to close the files. DROP
501+
* TABLESPACE should not give up on the tablespace becoming empty
502+
* until all relevant invalidation processing is complete.
496503
*/
497504
RequestCheckpoint(CHECKPOINT_IMMEDIATE |CHECKPOINT_FORCE |CHECKPOINT_WAIT);
498505
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