_calculate_ops relying on a config which can be modified on the fly will cause a bug. e.g.
1. A file has 20 objects and filer_max_purge_ops config was 10.
2. calling PurgeQueue::_execute_item and _calculate_ops returns 10, so ops_in_flight add 10.
3. adjust filer_max_purge_ops to 20 on the fly
4. calling PurgeQueue::_execute_item_complete and _calculate_ops returns 20, so ops_in_flight dec 20.
5. since ops_in_flight is uint64, this cause an overflow which makes ops_in_flight far more
greater than max_purge_ops and can't go back to a reasonable value.
filer_max_purge_ops will still work when _do_purge_range, so it's ok to ignore it here.
Fixes: https://tracker.ceph.com/issues/58008
Signed-off-by: haoyixing <haoyixing@kuaishou.com>
const uint64_t num = (item.size > 0) ?
Striper::get_num_objects(item.layout, item.size) : 1;
- ops_required = std::min(num, g_conf()->filer_max_purge_ops);
+ ops_required = num;
// Account for deletions for old pools
if (item.action != PurgeItem::TRUNCATE_FILE) {
return "UNKNOWN";
}
}
-