pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Don't rely on estimates for amcheck Bloom filters.
3+ messages / 1 participants
[nested] [flat]

* pgsql: Don't rely on estimates for amcheck Bloom filters.
@ 2019-07-20 18:12 Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 3+ messages in thread

From: Peter Geoghegan @ 2019-07-20 18:12 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/894af78f185afee221a6762a1a49057043b7bbf5

Modified Files
--------------
contrib/amcheck/verify_nbtree.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Don't rely on estimates for amcheck Bloom filters.
@ 2019-07-20 18:12 Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 3+ messages in thread

From: Peter Geoghegan @ 2019-07-20 18:12 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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.

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/980224b4a23056de76d902b539980868d33d1b8d

Modified Files
--------------
contrib/amcheck/verify_nbtree.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Don't rely on estimates for amcheck Bloom filters.
@ 2019-07-20 18:12 Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 3+ messages in thread

From: Peter Geoghegan @ 2019-07-20 18:12 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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.

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/577c8802d350e76bb0bb2b7ce5bcac551abd90d1

Modified Files
--------------
contrib/amcheck/verify_nbtree.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2019-07-20 18:12 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-07-20 18:12 pgsql: Don't rely on estimates for amcheck Bloom filters. Peter Geoghegan <pg@bowt.ie>
2019-07-20 18:12 pgsql: Don't rely on estimates for amcheck Bloom filters. Peter Geoghegan <pg@bowt.ie>
2019-07-20 18:12 pgsql: Don't rely on estimates for amcheck Bloom filters. Peter Geoghegan <pg@bowt.ie>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox