summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-02-11 20:50:09 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-02-11 21:31:39 +0000
commit6f529be6a611d26aefc04fa0a924718c5c80f74b (patch)
treee24484bc7a0310bbbc9cdb1fa5dd8aec94dd5932
parent034b0392265e6e02e00aa06196697fea3f67220f (diff)
Ensure that we do not go above 16G as we then might trigger other internal limits that we do not have
full control of.
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/memory_flush_config_updater.cpp13
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.h23
2 files changed, 17 insertions, 19 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/memory_flush_config_updater.cpp b/searchcore/src/vespa/searchcore/proton/server/memory_flush_config_updater.cpp
index c67a43e9edd..f2d45c996ae 100644
--- a/searchcore/src/vespa/searchcore/proton/server/memory_flush_config_updater.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/memory_flush_config_updater.cpp
@@ -111,12 +111,15 @@ MemoryFlushConfigUpdater::setNodeRetired(bool nodeRetired)
}
namespace {
+// This is a hard limit to ensure that we stop before we reach some internal limits.
+// This responsibility should not be here, but in each of the components
+
+constexpr uint64_t MAX_HARD_MEMORY_LIMIT_16G = 16ul * 1024ul * 1024ul * 1024ul;
size_t
getHardMemoryLimit(const HwInfo::Memory &memory)
{
- return std::max((size_t) memory.sizeBytes() / 4,
- (size_t) 16ul * 1024ul * 1024ul * 1024ul);
+ return std::min(memory.sizeBytes() / 4, MAX_HARD_MEMORY_LIMIT_16G);
}
}
@@ -130,16 +133,14 @@ MemoryFlushConfigUpdater::convertConfig(const ProtonConfig::Flush::Memory &confi
if (totalMaxMemory > hardMemoryLimit) {
LOG(info, "flush.memory.maxmemory=%" PRId64 " cannot"
" be set above the hard limit of %ld so we cap it to the hard limit",
- config.maxmemory,
- hardMemoryLimit);
+ config.maxmemory, hardMemoryLimit);
totalMaxMemory = hardMemoryLimit;
}
size_t eachMaxMemory = config.each.maxmemory;
if (eachMaxMemory > hardMemoryLimit) {
LOG(info, "flush.memory.each.maxmemory=%" PRId64 " cannot"
" be set above the hard limit of %ld so we cap it to the hard limit",
- config.maxmemory,
- hardMemoryLimit);
+ config.maxmemory, hardMemoryLimit);
eachMaxMemory = hardMemoryLimit;
}
return MemoryFlush::Config(totalMaxMemory,
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.h b/searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.h
index 50ae2000a11..5573a646d1b 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.h
+++ b/searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.h
@@ -4,8 +4,7 @@
#include "indexmaintainer.h"
#include <vespa/searchcorespi/flush/iflushtarget.h>
-namespace searchcorespi {
-namespace index {
+namespace searchcorespi::index {
/**
* Flush target for flushing a memory index in an IndexMaintainer.
@@ -23,18 +22,16 @@ public:
~IndexFlushTarget();
// Implements IFlushTarget
- virtual MemoryGain getApproxMemoryGain() const override;
- virtual DiskGain getApproxDiskGain() const override;
- virtual SerialNum getFlushedSerialNum() const override;
- virtual Time getLastFlushTime() const override;
+ MemoryGain getApproxMemoryGain() const override;
+ DiskGain getApproxDiskGain() const override;
+ SerialNum getFlushedSerialNum() const override;
+ Time getLastFlushTime() const override;
- virtual bool needUrgentFlush() const override;
+ bool needUrgentFlush() const override;
- virtual Task::UP initFlush(SerialNum currentSerial, std::shared_ptr<search::IFlushToken> flush_token) override;
- virtual FlushStats getLastFlushStats() const override { return _lastStats; }
- virtual uint64_t getApproxBytesToWriteToDisk() const override;
+ Task::UP initFlush(SerialNum currentSerial, std::shared_ptr<search::IFlushToken> flush_token) override;
+ FlushStats getLastFlushStats() const override { return _lastStats; }
+ uint64_t getApproxBytesToWriteToDisk() const override;
};
-} // namespace index
-} // namespace searchcorespi
-
+}