summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@yahoo-inc.com>2016-11-28 10:24:30 +0000
committerTor Egge <Tor.Egge@yahoo-inc.com>2016-11-28 10:24:30 +0000
commit808d74d5bff1ff6b10a63e55ef31ad6d942cee35 (patch)
tree40f2b9b1d950659076f4cc00bb48cf04eb890fea
parentfcea5dbb1420cda9f40866e247a6bbb6d24553bc (diff)
Extend compaction strategy with separate limit for address space.
-rw-r--r--searchcommon/src/vespa/searchcommon/common/compaction_strategy.h17
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multi_value_mapping2_base.cpp4
2 files changed, 13 insertions, 8 deletions
diff --git a/searchcommon/src/vespa/searchcommon/common/compaction_strategy.h b/searchcommon/src/vespa/searchcommon/common/compaction_strategy.h
index b67afac8f5e..7c30f36ad74 100644
--- a/searchcommon/src/vespa/searchcommon/common/compaction_strategy.h
+++ b/searchcommon/src/vespa/searchcommon/common/compaction_strategy.h
@@ -12,19 +12,24 @@ namespace search {
class CompactionStrategy
{
private:
- double _maxDeadRatio; // Max ratio of dead bytes before compaction
+ double _maxDeadBytesRatio; // Max ratio of dead bytes before compaction
+ double _maxDeadAddressSpaceRatio; // Max ratio of dead address space before compaction
public:
CompactionStrategy()
- : _maxDeadRatio(0.2)
+ : _maxDeadBytesRatio(0.2),
+ _maxDeadAddressSpaceRatio(0.2)
{
}
- CompactionStrategy(double maxDeadRatio)
- : _maxDeadRatio(maxDeadRatio)
+ CompactionStrategy(double maxDeadBytesRatio, double maxDeadAddressSpaceRatio)
+ : _maxDeadBytesRatio(maxDeadBytesRatio),
+ _maxDeadAddressSpaceRatio(maxDeadAddressSpaceRatio)
{
}
- double getMaxDeadRatio() const { return _maxDeadRatio; }
+ double getMaxDeadBytesRatio() const { return _maxDeadBytesRatio; }
+ double getMaxDeadAddressSpaceRatio() const { return _maxDeadAddressSpaceRatio; }
bool operator==(const CompactionStrategy & rhs) const {
- return _maxDeadRatio == rhs._maxDeadRatio;
+ return _maxDeadBytesRatio == rhs._maxDeadBytesRatio &&
+ _maxDeadAddressSpaceRatio == rhs._maxDeadAddressSpaceRatio;
}
bool operator!=(const CompactionStrategy & rhs) const { return !(operator==(rhs)); }
};
diff --git a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping2_base.cpp b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping2_base.cpp
index a95cafb5c24..d9f9df30608 100644
--- a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping2_base.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping2_base.cpp
@@ -87,9 +87,9 @@ MultiValueMapping2Base::considerCompact(const CompactionStrategy &compactionStra
size_t usedClusters = _cachedArrayStoreAddressSpaceUsage.used();
size_t deadClusters = _cachedArrayStoreAddressSpaceUsage.dead();
bool compactMemory = ((deadBytes >= DEAD_BYTES_SLACK) &&
- (usedBytes * compactionStrategy.getMaxDeadRatio() < deadBytes));
+ (usedBytes * compactionStrategy.getMaxDeadBytesRatio() < deadBytes));
bool compactAddressSpace = ((deadClusters >= DEAD_CLUSTERS_SLACK) &&
- (usedClusters * compactionStrategy.getMaxDeadRatio() < deadClusters));
+ (usedClusters * compactionStrategy.getMaxDeadAddressSpaceRatio() < deadClusters));
if (compactMemory || compactAddressSpace) {
compactWorst();
return true;