diff options
author | Tor Egge <Tor.Egge@online.no> | 2021-04-09 13:28:14 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2021-04-09 13:34:07 +0200 |
commit | 4977b304ca6e5468af47b91bd8526e1615a34fe1 (patch) | |
tree | e44fbfa3e61f518128cc88f1d51b36c5a5e88cd3 /searchcore | |
parent | cef30b122011ac98ef5b398eed50df942d95d9c6 (diff) |
Add CompactionStrategy methods to determine if compaction should be performed.
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp index d0cada2224f..23481aa416a 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastore.cpp @@ -199,13 +199,6 @@ DocumentMetaStore::insert(GidToLidMapKey key, const RawDocumentMetaData &metaDat updateCommittedDocIdLimit(); } -namespace { - -// minimum dead bytes in gid to lid map before consider compaction -constexpr size_t DEAD_BYTES_SLACK = 0x10000u; - -} - bool DocumentMetaStore::consider_compact_gid_to_lid_map() { @@ -215,9 +208,7 @@ DocumentMetaStore::consider_compact_gid_to_lid_map() auto &compaction_strategy = getConfig().getCompactionStrategy(); size_t used_bytes = _cached_gid_to_lid_map_memory_usage.usedBytes(); size_t dead_bytes = _cached_gid_to_lid_map_memory_usage.deadBytes(); - bool compact_memory = ((dead_bytes >= DEAD_BYTES_SLACK) && - (used_bytes * compaction_strategy.getMaxDeadBytesRatio() < dead_bytes)); - return compact_memory; + return compaction_strategy.should_compact_memory(used_bytes, dead_bytes); } void |