diff options
author | Teodor Sigaev <teodor@sigaev.ru> | 2018-04-25 18:02:55 +0300 |
---|---|---|
committer | Teodor Sigaev <teodor@sigaev.ru> | 2018-04-25 18:02:55 +0300 |
commit | 4eaf7eaccb291f5d32d9f05284bfca9c5744de9a (patch) | |
tree | c4f4ef2c28d23aad6e4b50463a5ac037cbdbf6cc /doc/src | |
parent | 7f58f666cdeee8016fd4ec7aa79629c983ecc3bd (diff) |
Add missing and dangling downlink checks to amcheck
When bt_index_parent_check() is called with the heapallindexed option,
allocate a second Bloom filter to fingerprint block numbers that appear
in the downlinks of internal pages. Use Bloom filter probes when
walking the B-Tree to detect missing downlinks. This can detect subtle
problems with page deletion/VACUUM, such as corruption caused by the bug
just fixed in commit 6db4b499.
The downlink Bloom filter is bound in size by work_mem. Its optimal
size is typically far smaller than that of the regular heapallindexed
Bloom filter, especially when the index has high fan-out.
Author: Peter Geoghegan
Reviewer: Teodor Sigaev
Discussion: https://postgr.es/m/CAH2-WznUzY4fWTjm1tBB3JpVz8cCfz7k_qVp5BhuPyhivmWJFg@mail.gmail.com
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/amcheck.sgml | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/doc/src/sgml/amcheck.sgml b/doc/src/sgml/amcheck.sgml index a712c86a10f..66a0232e240 100644 --- a/doc/src/sgml/amcheck.sgml +++ b/doc/src/sgml/amcheck.sgml @@ -55,7 +55,7 @@ <function>bt_index_check</function> tests that its target, a B-Tree index, respects a variety of invariants. Example usage: <screen> -test=# SELECT bt_index_check(index => c.oid, heapallindexed => i.indisunique) +test=# SELECT bt_index_check(index => c.oid, heapallindexed => i.indisunique), c.relname, c.relpages FROM pg_index i @@ -67,7 +67,7 @@ WHERE am.amname = 'btree' AND n.nspname = 'pg_catalog' -- Don't check temp tables, which may be from another session: AND c.relpersistence != 't' -- Function may throw an error when this is omitted: -AND i.indisready AND i.indisvalid +AND c.relkind = 'i' AND i.indisready AND i.indisvalid ORDER BY c.relpages DESC LIMIT 10; bt_index_check | relname | relpages ----------------+---------------------------------+---------- @@ -126,7 +126,8 @@ ORDER BY c.relpages DESC LIMIT 10; Optionally, when the <parameter>heapallindexed</parameter> argument is <literal>true</literal>, the function verifies the presence of all heap tuples that should be found within the - index. The checks that can be performed by + index, and that there are no missing downlinks in the index + structure. The checks that can be performed by <function>bt_index_parent_check</function> are a superset of the checks that can be performed by <function>bt_index_check</function>. <function>bt_index_parent_check</function> can be thought of as |