mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-31 03:56:42 +00:00
When we start the LSA reclamation it can be that segment_pool::_free_segments is 0 under some conditions and segment_pool::_current_emergency_reserve_goal is set to 1. The reclamation step is 1 segment, and compact_and_evict_locked() frees 1 segment back into the segment_pool. However, segment_pool::reclaim_segments() doesn't free anything to the standard allocator because the condition _free_segments > _current_emergency_reserve_goal is false. As a result, tracker::impl::reclaim() returns 0 as the amount of released memory, tracker::reclaim() returns memory::reclaiming_result::reclaimed_nothing and the seastar allocator thinks it's a real OOM and throws std::bad_alloc. The fix is to change compact_and_evict() to make sure that reserves are met, by releasing more if they're not met at entry. This change also allows us to drop the variant of allocate_segment() which accepts the reclamation step as a means to refill reserves faster. This is now not needed, because compact_and_evict() will look at the reserve deficit to increase the amount of memory to reclaim. Fixes #4445 Message-Id: <1555671713-16530-1-git-send-email-tgrabiec@scylladb.com>
80 KiB
80 KiB