postgresql/contrib/amcheck
Peter Geoghegan 894af78f18 Don't rely on estimates for amcheck Bloom filters.
Solely relying on a relation's reltuples/relpages estimate to size the
Bloom filters used by amcheck verification makes verification less
effective when the estimates are very stale.  In extreme cases,
verification options that use Bloom filters internally could be totally
ineffective, without users receiving any clear indication that certain
types of corruption might easily be missed.

To fix, use RelationGetNumberOfBlocks() instead of relpages to size the
downlink block Bloom filter.  Use the same RelationGetNumberOfBlocks()
value to derive a minimum size for the heapallindexed Bloom filter,
rather than completely trusting reltuples.  Verification will still be
reasonably effective when the projected/estimated number of Bloom filter
elements is at least 1/5 of the final number of elements, which is
assured by the new sizing logic.

Reported-By: Alexander Korotkov
Discussion: https://postgr.es/m/CAH2-Wzk0ke2J42KrNYBKu0Xovjy-sU5ub7PWjgpbsKdAQcL4OA@mail.gmail.com
Backpatch: 11-, where downlink/heapallindexed verification were added.
2019-07-20 11:11:55 -07:00
..
expected Follow the rule that regression-test-created roles are named "regress_xxx". 2019-06-25 23:06:17 -04:00
sql Follow the rule that regression-test-created roles are named "regress_xxx". 2019-06-25 23:06:17 -04:00
.gitignore Add .gitignore to contrib/amcheck. 2017-03-09 22:45:24 -05:00
Makefile Allow amcheck to re-find tuples using new search. 2019-03-20 10:41:36 -07:00
amcheck--1.0--1.1.sql Add amcheck verification of heap relations belonging to btree indexes. 2018-03-31 19:52:01 -07:00
amcheck--1.0.sql Add amcheck extension to contrib. 2017-03-09 16:33:02 -08:00
amcheck--1.1--1.2.sql Allow amcheck to re-find tuples using new search. 2019-03-20 10:41:36 -07:00
amcheck.control Allow amcheck to re-find tuples using new search. 2019-03-20 10:41:36 -07:00
verify_nbtree.c Don't rely on estimates for amcheck Bloom filters. 2019-07-20 11:11:55 -07:00