diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-05-08 06:44:00 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-05-08 06:44:00 +0000 |
commit | e9232a8ddd53b4e5152748330e9ffd5f7b9c3b14 (patch) | |
tree | 61e628bf4b4eb58b009ec9012ab4eaaa9643561a /searchcore | |
parent | ea85e10adc727553a2b78f3634340912f184da06 (diff) |
Remove double bookeeping and simplify.
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp | 11 | ||||
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h | 2 |
2 files changed, 6 insertions, 7 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp index 6dcd9d30d13..51713f26307 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp @@ -176,7 +176,7 @@ FlushEngine::wait_for_slot_or_pending_prune(IFlushTarget::Priority priority) } } -std::pair<bool, vespalib::string> +vespalib::string FlushEngine::checkAndFlush(vespalib::string prev) { std::pair<FlushContext::List, bool> lst = getSortedTargetList(); if (lst.second) { @@ -189,10 +189,10 @@ FlushEngine::checkAndFlush(vespalib::string prev) { // Sleep 1 ms after a successful flush in order to avoid busy loop in case // of strategy or target error. std::this_thread::sleep_for(1ms); - return {false, prev}; + return prev; } } - return {true, ""}; + return ""; } void @@ -206,9 +206,8 @@ FlushEngine::run() if (prune()) { // Prune attempted on one or more handlers } else { - auto [needWait, name] = checkAndFlush(prevFlushName); - prevFlushName = name; - if (needWait) { + prevFlushName = checkAndFlush(prevFlushName); + if (prevFlushName.empty()) { wait(idleInterval); } } diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h index 079d36dd530..0be086729fa 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h @@ -88,7 +88,7 @@ private: wait(minimumWaitTimeIfReady, false); } bool isFlushing(const std::lock_guard<std::mutex> &guard, const vespalib::string & name) const; - std::pair<bool, vespalib::string> checkAndFlush(vespalib::string prev); + vespalib::string checkAndFlush(vespalib::string prev); friend class FlushTask; friend class FlushEngineExplorer; |