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

Commit44f4986

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 parent2a938c7 commit44f4986

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
@@ -99,5 +99,10 @@ ERROR: cannot drop access method gist2 because other objects depend on it
9999
DETAIL: index grect2ind2 depends on operator class box_ops for access method gist2
100100
HINT: Use DROP ... CASCADE to drop the dependent objects too.
101101
-- Drop access method cascade
102+
-- To prevent a (rare) deadlock against autovacuum,
103+
-- we must lock the table that owns the index that will be dropped
104+
BEGIN;
105+
LOCK TABLE fast_emp4000;
102106
DROP ACCESS METHOD gist2 CASCADE;
103107
NOTICE: drop cascades to index grect2ind2
108+
COMMIT;

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,9 @@ ROLLBACK;
6767
DROP ACCESS METHOD gist2;
6868

6969
-- Drop access method cascade
70+
-- To prevent a (rare) deadlock against autovacuum,
71+
-- we must lock the table that owns the index that will be dropped
72+
BEGIN;
73+
LOCK TABLE fast_emp4000;
7074
DROP ACCESS METHOD gist2 CASCADE;
75+
COMMIT;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp