mirror of
https://github.com/postgres/postgres.git
synced 2025-05-08 07:21:33 +03:00
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
This commit is contained in:
parent
5129026434
commit
0d68ad3fc2
@ -833,7 +833,7 @@ _bt_vacuum_needs_cleanup(IndexVacuumInfo *info)
|
||||
prev_num_heap_tuples = metad->btm_last_cleanup_num_heap_tuples;
|
||||
|
||||
if (cleanup_scale_factor <= 0 ||
|
||||
prev_num_heap_tuples < 0 ||
|
||||
prev_num_heap_tuples <= 0 ||
|
||||
(info->num_heap_tuples - prev_num_heap_tuples) /
|
||||
prev_num_heap_tuples >= cleanup_scale_factor)
|
||||
result = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user