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

Commit7150402

Browse files
committed
amcheck: Harden tests against concurrent autovacuums.
The previous coding of the test was vulnerable against autovacuumtriggering work on one of the tables in check_btree.sql.For the purpose of the test it's entirely sufficient to check forlocks taken by the current process, so add an appropriate restriction.While touching the test, expand it to also check for locks on theunderlying relations, rather than just the indexes.Reported-By: Tom LaneDiscussion:https://postgr.es/m/30354.1489434301@sss.pgh.pa.us
1 parentbb4a396 commit7150402

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

‎contrib/amcheck/expected/check_btree.out

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ SELECT bt_index_parent_check('bttest_b_idx');
7777
(1 row)
7878

7979
-- make sure we don't have any leftover locks
80-
SELECT * FROM pg_locks WHERE relation IN ('bttest_a_idx'::regclass, 'bttest_b_idx'::regclass);
80+
SELECT * FROM pg_locks
81+
WHERE relation = ANY(ARRAY['bttest_a', 'bttest_a_idx', 'bttest_b', 'bttest_b_idx']::regclass[])
82+
AND pid = pg_backend_pid();
8183
locktype | database | relation | page | tuple | virtualxid | transactionid | classid | objid | objsubid | virtualtransaction | pid | mode | granted | fastpath
8284
----------+----------+----------+------+-------+------------+---------------+---------+-------+----------+--------------------+-----+------+---------+----------
8385
(0 rows)

‎contrib/amcheck/sql/check_btree.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ BEGIN;
4949
SELECT bt_index_check('bttest_a_idx');
5050
SELECT bt_index_parent_check('bttest_b_idx');
5151
-- make sure we don't have any leftover locks
52-
SELECT*FROM pg_locksWHERE relationIN ('bttest_a_idx'::regclass,'bttest_b_idx'::regclass);
52+
SELECT*FROM pg_locks
53+
WHERE relation= ANY(ARRAY['bttest_a','bttest_a_idx','bttest_b','bttest_b_idx']::regclass[])
54+
AND pid= pg_backend_pid();
5355
COMMIT;
5456

5557
-- cleanup

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp