mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Add test coverage for rootdescend verification.
Commit c1afd175
, 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.
This commit is contained in:
@ -109,17 +109,17 @@ SELECT bt_index_check('bttest_multi_idx');
|
|||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- more expansive test for index with included columns
|
-- more expansive tests for index with included columns
|
||||||
SELECT bt_index_parent_check('bttest_multi_idx', true);
|
SELECT bt_index_parent_check('bttest_multi_idx', true, true);
|
||||||
bt_index_parent_check
|
bt_index_parent_check
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- repeat expansive test for index built using insertions
|
-- repeat expansive tests for index built using insertions
|
||||||
TRUNCATE bttest_multi;
|
TRUNCATE bttest_multi;
|
||||||
INSERT INTO bttest_multi SELECT i, i%2 FROM generate_series(1, 100000) as i;
|
INSERT INTO bttest_multi SELECT i, i%2 FROM generate_series(1, 100000) as i;
|
||||||
SELECT bt_index_parent_check('bttest_multi_idx', true);
|
SELECT bt_index_parent_check('bttest_multi_idx', true, true);
|
||||||
bt_index_parent_check
|
bt_index_parent_check
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
@ -131,14 +131,11 @@ SELECT bt_index_parent_check('bttest_multi_idx', true);
|
|||||||
--
|
--
|
||||||
INSERT INTO delete_test_table SELECT i, 1, 2, 3 FROM generate_series(1,80000) i;
|
INSERT INTO delete_test_table SELECT i, 1, 2, 3 FROM generate_series(1,80000) i;
|
||||||
ALTER TABLE delete_test_table ADD PRIMARY KEY (a,b,c,d);
|
ALTER TABLE delete_test_table ADD PRIMARY KEY (a,b,c,d);
|
||||||
-- Delete many entries, and vacuum. This causes page deletions.
|
|
||||||
DELETE FROM delete_test_table WHERE a > 40000;
|
|
||||||
VACUUM delete_test_table;
|
|
||||||
-- Delete most entries, and vacuum, deleting internal pages and creating "fast
|
-- Delete most entries, and vacuum, deleting internal pages and creating "fast
|
||||||
-- root"
|
-- root"
|
||||||
DELETE FROM delete_test_table WHERE a < 79990;
|
DELETE FROM delete_test_table WHERE a < 79990;
|
||||||
VACUUM delete_test_table;
|
VACUUM delete_test_table;
|
||||||
SELECT bt_index_parent_check('delete_test_table_pkey', true, true);
|
SELECT bt_index_parent_check('delete_test_table_pkey', true);
|
||||||
bt_index_parent_check
|
bt_index_parent_check
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
@ -69,13 +69,13 @@ COMMIT;
|
|||||||
|
|
||||||
-- normal check outside of xact for index with included columns
|
-- normal check outside of xact for index with included columns
|
||||||
SELECT bt_index_check('bttest_multi_idx');
|
SELECT bt_index_check('bttest_multi_idx');
|
||||||
-- more expansive test for index with included columns
|
-- more expansive tests for index with included columns
|
||||||
SELECT bt_index_parent_check('bttest_multi_idx', true);
|
SELECT bt_index_parent_check('bttest_multi_idx', true, true);
|
||||||
|
|
||||||
-- repeat expansive test for index built using insertions
|
-- repeat expansive tests for index built using insertions
|
||||||
TRUNCATE bttest_multi;
|
TRUNCATE bttest_multi;
|
||||||
INSERT INTO bttest_multi SELECT i, i%2 FROM generate_series(1, 100000) as i;
|
INSERT INTO bttest_multi SELECT i, i%2 FROM generate_series(1, 100000) as i;
|
||||||
SELECT bt_index_parent_check('bttest_multi_idx', true);
|
SELECT bt_index_parent_check('bttest_multi_idx', true, true);
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Test for multilevel page deletion/downlink present checks, and rootdescend
|
-- Test for multilevel page deletion/downlink present checks, and rootdescend
|
||||||
@ -83,14 +83,11 @@ SELECT bt_index_parent_check('bttest_multi_idx', true);
|
|||||||
--
|
--
|
||||||
INSERT INTO delete_test_table SELECT i, 1, 2, 3 FROM generate_series(1,80000) i;
|
INSERT INTO delete_test_table SELECT i, 1, 2, 3 FROM generate_series(1,80000) i;
|
||||||
ALTER TABLE delete_test_table ADD PRIMARY KEY (a,b,c,d);
|
ALTER TABLE delete_test_table ADD PRIMARY KEY (a,b,c,d);
|
||||||
-- Delete many entries, and vacuum. This causes page deletions.
|
|
||||||
DELETE FROM delete_test_table WHERE a > 40000;
|
|
||||||
VACUUM delete_test_table;
|
|
||||||
-- Delete most entries, and vacuum, deleting internal pages and creating "fast
|
-- Delete most entries, and vacuum, deleting internal pages and creating "fast
|
||||||
-- root"
|
-- root"
|
||||||
DELETE FROM delete_test_table WHERE a < 79990;
|
DELETE FROM delete_test_table WHERE a < 79990;
|
||||||
VACUUM delete_test_table;
|
VACUUM delete_test_table;
|
||||||
SELECT bt_index_parent_check('delete_test_table_pkey', true, true);
|
SELECT bt_index_parent_check('delete_test_table_pkey', true);
|
||||||
|
|
||||||
--
|
--
|
||||||
-- BUG #15597: must not assume consistent input toasting state when forming
|
-- BUG #15597: must not assume consistent input toasting state when forming
|
||||||
|
@ -3225,9 +3225,6 @@ explain (costs off)
|
|||||||
CREATE TABLE delete_test_table (a bigint, b bigint, c bigint, d bigint);
|
CREATE TABLE delete_test_table (a bigint, b bigint, c bigint, d bigint);
|
||||||
INSERT INTO delete_test_table SELECT i, 1, 2, 3 FROM generate_series(1,80000) i;
|
INSERT INTO delete_test_table SELECT i, 1, 2, 3 FROM generate_series(1,80000) i;
|
||||||
ALTER TABLE delete_test_table ADD PRIMARY KEY (a,b,c,d);
|
ALTER TABLE delete_test_table ADD PRIMARY KEY (a,b,c,d);
|
||||||
-- Delete many entries, and vacuum. This causes page deletions.
|
|
||||||
DELETE FROM delete_test_table WHERE a > 40000;
|
|
||||||
VACUUM delete_test_table;
|
|
||||||
-- Delete most entries, and vacuum, deleting internal pages and creating "fast
|
-- Delete most entries, and vacuum, deleting internal pages and creating "fast
|
||||||
-- root"
|
-- root"
|
||||||
DELETE FROM delete_test_table WHERE a < 79990;
|
DELETE FROM delete_test_table WHERE a < 79990;
|
||||||
|
@ -1146,9 +1146,6 @@ explain (costs off)
|
|||||||
CREATE TABLE delete_test_table (a bigint, b bigint, c bigint, d bigint);
|
CREATE TABLE delete_test_table (a bigint, b bigint, c bigint, d bigint);
|
||||||
INSERT INTO delete_test_table SELECT i, 1, 2, 3 FROM generate_series(1,80000) i;
|
INSERT INTO delete_test_table SELECT i, 1, 2, 3 FROM generate_series(1,80000) i;
|
||||||
ALTER TABLE delete_test_table ADD PRIMARY KEY (a,b,c,d);
|
ALTER TABLE delete_test_table ADD PRIMARY KEY (a,b,c,d);
|
||||||
-- Delete many entries, and vacuum. This causes page deletions.
|
|
||||||
DELETE FROM delete_test_table WHERE a > 40000;
|
|
||||||
VACUUM delete_test_table;
|
|
||||||
-- Delete most entries, and vacuum, deleting internal pages and creating "fast
|
-- Delete most entries, and vacuum, deleting internal pages and creating "fast
|
||||||
-- root"
|
-- root"
|
||||||
DELETE FROM delete_test_table WHERE a < 79990;
|
DELETE FROM delete_test_table WHERE a < 79990;
|
||||||
|
Reference in New Issue
Block a user