aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-12-05 15:23:56 +0100
committerGitHub <noreply@github.com>2017-12-05 15:23:56 +0100
commitfa22b79f210ed7d8b585abb2ac0fb3c7b9f8e65c (patch)
tree8a86422542a5a8d5646aa225a30bdaaee1d6c212
parent87304dd236b562117e96ca06bab1a7cd85149344 (diff)
parent9f1dff759284838b27c05c08c41af88c054a34c6 (diff)
Merge pull request #4357 from vespa-engine/toregge/delay-check-of-totals-until-we-have-totals
Delay check of total memory and disk gains until we have calculated the totals.
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp b/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp
index e80f2645fcf..ea787868f18 100644
--- a/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp
@@ -120,13 +120,6 @@ size_t
computeGain(const IFlushTarget::DiskGain & gain) {
return std::max(100000000l, std::max(gain.getBefore(), gain.getAfter()));
}
-bool isDiskBloatToHigh(const IFlushTarget::DiskGain & totalDisk,
- const MemoryFlush::Config & config,
- const IFlushTarget::DiskGain & dgain)
-{
- return (totalDisk.gain() > config.globalDiskBloatFactor * computeGain(totalDisk))
- || (dgain.gain() > config.diskBloatFactor * computeGain(dgain));
-}
}
@@ -167,9 +160,9 @@ MemoryFlush::getFlushTargets(const FlushContext::List &targetList,
order = TLSSIZE;
}
}
- if (((totalMemory >= config.maxGlobalMemory) || (mgain >= config.maxMemoryGain)) && (order < MEMORY)) {
+ if ((mgain >= config.maxMemoryGain) && (order < MEMORY)) {
order = MEMORY;
- } else if (isDiskBloatToHigh(totalDisk, config, dgain) && (order < DISKBLOAT)) {
+ } else if ((dgain.gain() > config.diskBloatFactor * computeGain(dgain)) && (order < DISKBLOAT)) {
order = DISKBLOAT;
} else if ((timeDiff >= config.maxTimeGain) && (order < MAXAGE)) {
order = MAXAGE;
@@ -195,6 +188,14 @@ MemoryFlush::getFlushTargets(const FlushContext::List &targetList,
timeDiff.sec(),
getOrderName(order).c_str());
}
+ if (!targetList.empty()) {
+ if ((totalMemory >= config.maxGlobalMemory) && (order < MEMORY)) {
+ order = MEMORY;
+ }
+ if ((totalDisk.gain() > config.globalDiskBloatFactor * computeGain(totalDisk)) && (order < DISKBLOAT)) {
+ order = DISKBLOAT;
+ }
+ }
FlushContext::List fv(targetList);
std::sort(fv.begin(), fv.end(), CompareTarget(order, tlsStatsMap));
// No desired order and no urgent needs; no flush required at this moment.