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

Commitd54f99e

Browse files
committed
Fix rare deadlock failure in create_am regression test.
The "DROP ACCESS METHOD gist2" test will require locking the indexto be dropped and then its table; while most ordinary operationslock a table first then its index. While no concurrent test scriptsshould be touching fast_emp4000, autovacuum might chance to beprocessing that table when the DROP runs, resulting in a deadlockfailure. This is pretty rare but we see it in the buildfarm fromtime to time.To fix, acquire a lock on fast_emp4000 before issuing the DROP.Since the point of the exercise is mostly to prevent buildfarmfailures, back-patch to 9.6 where this test was introduced.Discussion:https://postgr.es/m/839004.1599185607@sss.pgh.pa.us
1 parent49d7165 commitd54f99e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

‎src/test/regress/expected/create_am.out

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,13 @@ ERROR: cannot drop access method gist2 because other objects depend on it
102102
DETAIL: index grect2ind2 depends on operator class box_ops for access method gist2
103103
HINT: Use DROP ... CASCADE to drop the dependent objects too.
104104
-- Drop access method cascade
105+
-- To prevent a (rare) deadlock against autovacuum,
106+
-- we must lock the table that owns the index that will be dropped
107+
BEGIN;
108+
LOCK TABLE fast_emp4000;
105109
DROP ACCESS METHOD gist2 CASCADE;
106110
NOTICE: drop cascades to index grect2ind2
111+
COMMIT;
107112
--
108113
-- Test table access methods
109114
--

‎src/test/regress/sql/create_am.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,12 @@ ROLLBACK;
7070
DROP ACCESS METHOD gist2;
7171

7272
-- Drop access method cascade
73+
-- To prevent a (rare) deadlock against autovacuum,
74+
-- we must lock the table that owns the index that will be dropped
75+
BEGIN;
76+
LOCK TABLE fast_emp4000;
7377
DROP ACCESS METHOD gist2 CASCADE;
78+
COMMIT;
7479

7580

7681
--

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp