]> granicus.if.org Git - postgresql/commitdiff
Add test coverage for rootdescend verification.
authorPeter Geoghegan <pg@bowt.ie>
Fri, 5 Apr 2019 00:25:35 +0000 (17:25 -0700)
committerPeter Geoghegan <pg@bowt.ie>
Fri, 5 Apr 2019 00:25:35 +0000 (17:25 -0700)
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.

contrib/amcheck/expected/check_btree.out
contrib/amcheck/sql/check_btree.sql
src/test/regress/expected/create_index.out
src/test/regress/sql/create_index.sql

index 6103aa4e47210a9c301db1c9c6652aa9c4636555..605eb191445a6cab750f77eab80494eb4fc04ace 100644 (file)
@@ -109,17 +109,17 @@ SELECT bt_index_check('bttest_multi_idx');
  
 (1 row)
 
--- more expansive test for index with included columns
-SELECT bt_index_parent_check('bttest_multi_idx', true);
+-- more expansive tests for index with included columns
+SELECT bt_index_parent_check('bttest_multi_idx', true, true);
  bt_index_parent_check 
 -----------------------
  
 (1 row)
 
--- repeat expansive test for index built using insertions
+-- repeat expansive tests for index built using insertions
 TRUNCATE bttest_multi;
 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 
 -----------------------
  
@@ -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;
 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
 -- root"
 DELETE FROM delete_test_table WHERE a < 79990;
 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 
 -----------------------
  
index f3e365f4bdf992bd094dc49e7af52ef8053e0c9b..2fd3dc388b1f94f3256446ddadc639b31cfe4627 100644 (file)
@@ -69,13 +69,13 @@ COMMIT;
 
 -- normal check outside of xact for index with included columns
 SELECT bt_index_check('bttest_multi_idx');
--- more expansive test for index with included columns
-SELECT bt_index_parent_check('bttest_multi_idx', true);
+-- more expansive tests for index with included columns
+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;
 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
@@ -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;
 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
 -- root"
 DELETE FROM delete_test_table WHERE a < 79990;
 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
index 6b77d25debf07abc9b17bc89a4a97829d86eacc2..388d709875cd2dd62f33552bea2d6ca14be5540a 100644 (file)
@@ -3225,9 +3225,6 @@ explain (costs off)
 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;
 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
 -- root"
 DELETE FROM delete_test_table WHERE a < 79990;
index 9ff2dc68ff1e0674b2bd8b7c49a44b5181618786..4d2535b48217481a3327c122d29097355ccbafbf 100644 (file)
@@ -1146,9 +1146,6 @@ explain (costs off)
 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;
 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
 -- root"
 DELETE FROM delete_test_table WHERE a < 79990;