Content-Length: 260131 | pFad | http://github.com/postgrespro/postgres/commit/1e871981823a68ec9e0174b652e8d27e05ce08bb

93 Fix division by zero in _bt_vacuum_needs_cleanup() · postgrespro/postgres@1e87198 · GitHub
Skip to content

Commit 1e87198

Browse files
committed
Fix division by zero in _bt_vacuum_needs_cleanup()
Checks inside _bt_vacuum_needs_cleanup() allow division by zero to happen when metad->btm_last_cleanup_num_heap_tuples == 0. This commit adjusts the expression so that no division by zero might happen. Reported-by: Piotr Stefaniak Discussion: https://postgr.es/m/DB8PR03MB5931C41F7787A95313F08322F22A0%40DB8PR03MB5931.eurprd03.prod.outlook.com Reviewed-by: Masahiko Sawada Backpatch-through: 11
1 parent 3a45321 commit 1e87198

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/access/nbtree/nbtree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ _bt_vacuum_needs_cleanup(IndexVacuumInfo *info)
835835
prev_num_heap_tuples = metad->btm_last_cleanup_num_heap_tuples;
836836

837837
if (cleanup_scale_factor <= 0 ||
838-
prev_num_heap_tuples < 0 ||
838+
prev_num_heap_tuples <= 0 ||
839839
(info->num_heap_tuples - prev_num_heap_tuples) /
840840
prev_num_heap_tuples >= cleanup_scale_factor)
841841
result = true;

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/1e871981823a68ec9e0174b652e8d27e05ce08bb

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy