diff options
Diffstat (limited to 'searchcommon/src')
-rw-r--r-- | searchcommon/src/vespa/searchcommon/common/compaction_strategy.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/searchcommon/src/vespa/searchcommon/common/compaction_strategy.h b/searchcommon/src/vespa/searchcommon/common/compaction_strategy.h index 8a9b94f3af8..65a7b5a276c 100644 --- a/searchcommon/src/vespa/searchcommon/common/compaction_strategy.h +++ b/searchcommon/src/vespa/searchcommon/common/compaction_strategy.h @@ -32,6 +32,20 @@ public: _maxDeadAddressSpaceRatio == rhs._maxDeadAddressSpaceRatio; } bool operator!=(const CompactionStrategy & rhs) const { return !(operator==(rhs)); } + + static constexpr size_t DEAD_BYTES_SLACK = 0x10000u; + + bool should_compact_memory(size_t used_bytes, size_t dead_bytes) const { + return ((dead_bytes >= DEAD_BYTES_SLACK) && + (dead_bytes > used_bytes * getMaxDeadBytesRatio())); + } + + static constexpr size_t DEAD_ADDRESS_SPACE_SLACK = 0x10000u; + + bool should_compact_address_space(size_t used_address_space, size_t dead_address_space) const { + return ((dead_address_space >= DEAD_ADDRESS_SPACE_SLACK) && + (dead_address_space > used_address_space * getMaxDeadAddressSpaceRatio())); + } }; std::ostream& operator<<(std::ostream& os, const CompactionStrategy& compaction_strategy); |