Skip to content

Commit 344b7e1

Browse files
Add test coverage for rootdescend verification.
Commit c1afd17, which added support for rootdescend verification to amcheck, added only minimal regression test coverage. Address this by making sure that rootdescend verification is run on a multi-level index. In passing, simplify some of the regression tests that exercise multi-level nbtree page deletion. Both issues spotted while rereviewing coverage of the nbtree patch series using gcov.
1 parent 86b8504 commit 344b7e1

File tree

4 files changed

+10
-22
lines changed

4 files changed

+10
-22
lines changed

contrib/amcheck/expected/check_btree.out

+5-8
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,17 @@ SELECT bt_index_check('bttest_multi_idx');
109109

110110
(1 row)
111111

112-
-- more expansive test for index with included columns
113-
SELECT bt_index_parent_check('bttest_multi_idx', true);
112+
-- more expansive tests for index with included columns
113+
SELECT bt_index_parent_check('bttest_multi_idx', true, true);
114114
bt_index_parent_check
115115
-----------------------
116116

117117
(1 row)
118118

119-
-- repeat expansive test for index built using insertions
119+
-- repeat expansive tests for index built using insertions
120120
TRUNCATE bttest_multi;
121121
INSERT INTO bttest_multi SELECT i, i%2 FROM generate_series(1, 100000) as i;
122-
SELECT bt_index_parent_check('bttest_multi_idx', true);
122+
SELECT bt_index_parent_check('bttest_multi_idx', true, true);
123123
bt_index_parent_check
124124
-----------------------
125125

@@ -131,14 +131,11 @@ SELECT bt_index_parent_check('bttest_multi_idx', true);
131131
--
132132
INSERT INTO delete_test_table SELECT i, 1, 2, 3 FROM generate_series(1,80000) i;
133133
ALTER TABLE delete_test_table ADD PRIMARY KEY (a,b,c,d);
134-
-- Delete many entries, and vacuum. This causes page deletions.
135-
DELETE FROM delete_test_table WHERE a > 40000;
136-
VACUUM delete_test_table;
137134
-- Delete most entries, and vacuum, deleting internal pages and creating "fast
138135
-- root"
139136
DELETE FROM delete_test_table WHERE a < 79990;
140137
VACUUM delete_test_table;
141-
SELECT bt_index_parent_check('delete_test_table_pkey', true, true);
138+
SELECT bt_index_parent_check('delete_test_table_pkey', true);
142139
bt_index_parent_check
143140
-----------------------
144141

contrib/amcheck/sql/check_btree.sql

+5-8
Original file line numberDiff line numberDiff line change
@@ -69,28 +69,25 @@ COMMIT;
6969

7070
-- normal check outside of xact for index with included columns
7171
SELECT bt_index_check('bttest_multi_idx');
72-
-- more expansive test for index with included columns
73-
SELECT bt_index_parent_check('bttest_multi_idx', true);
72+
-- more expansive tests for index with included columns
73+
SELECT bt_index_parent_check('bttest_multi_idx', true, true);
7474

75-
-- repeat expansive test for index built using insertions
75+
-- repeat expansive tests for index built using insertions
7676
TRUNCATE bttest_multi;
7777
INSERT INTO bttest_multi SELECT i, i%2 FROM generate_series(1, 100000) as i;
78-
SELECT bt_index_parent_check('bttest_multi_idx', true);
78+
SELECT bt_index_parent_check('bttest_multi_idx', true, true);
7979

8080
--
8181
-- Test for multilevel page deletion/downlink present checks, and rootdescend
8282
-- checks
8383
--
8484
INSERT INTO delete_test_table SELECT i, 1, 2, 3 FROM generate_series(1,80000) i;
8585
ALTER TABLE delete_test_table ADD PRIMARY KEY (a,b,c,d);
86-
-- Delete many entries, and vacuum. This causes page deletions.
87-
DELETE FROM delete_test_table WHERE a > 40000;
88-
VACUUM delete_test_table;
8986
-- Delete most entries, and vacuum, deleting internal pages and creating "fast
9087
-- root"
9188
DELETE FROM delete_test_table WHERE a < 79990;
9289
VACUUM delete_test_table;
93-
SELECT bt_index_parent_check('delete_test_table_pkey', true, true);
90+
SELECT bt_index_parent_check('delete_test_table_pkey', true);
9491

9592
--
9693
-- BUG #15597: must not assume consistent input toasting state when forming

src/test/regress/expected/create_index.out

-3
Original file line numberDiff line numberDiff line change
@@ -3225,9 +3225,6 @@ explain (costs off)
32253225
CREATE TABLE delete_test_table (a bigint, b bigint, c bigint, d bigint);
32263226
INSERT INTO delete_test_table SELECT i, 1, 2, 3 FROM generate_series(1,80000) i;
32273227
ALTER TABLE delete_test_table ADD PRIMARY KEY (a,b,c,d);
3228-
-- Delete many entries, and vacuum. This causes page deletions.
3229-
DELETE FROM delete_test_table WHERE a > 40000;
3230-
VACUUM delete_test_table;
32313228
-- Delete most entries, and vacuum, deleting internal pages and creating "fast
32323229
-- root"
32333230
DELETE FROM delete_test_table WHERE a < 79990;

src/test/regress/sql/create_index.sql

-3
Original file line numberDiff line numberDiff line change
@@ -1146,9 +1146,6 @@ explain (costs off)
11461146
CREATE TABLE delete_test_table (a bigint, b bigint, c bigint, d bigint);
11471147
INSERT INTO delete_test_table SELECT i, 1, 2, 3 FROM generate_series(1,80000) i;
11481148
ALTER TABLE delete_test_table ADD PRIMARY KEY (a,b,c,d);
1149-
-- Delete many entries, and vacuum. This causes page deletions.
1150-
DELETE FROM delete_test_table WHERE a > 40000;
1151-
VACUUM delete_test_table;
11521149
-- Delete most entries, and vacuum, deleting internal pages and creating "fast
11531150
-- root"
11541151
DELETE FROM delete_test_table WHERE a < 79990;

0 commit comments

Comments
 (0)