diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-05-08 06:34:46 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-05-08 06:34:46 +0000 |
commit | ea85e10adc727553a2b78f3634340912f184da06 (patch) | |
tree | 8fa2778ac23214c7dd456eb536df9a1c1799d348 /searchcore | |
parent | f32aded80e93429a376a7c671a8c22ffa2c11ded (diff) |
Wait for a pending prune or a high priority slot before continuing.
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp | 6 | ||||
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp index 772216e7f37..6dcd9d30d13 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp @@ -167,7 +167,7 @@ FlushEngine::wait(vespalib::duration minimumWaitTimeIfReady, bool ignorePendingP } void -FlushEngine::wait_for_slot(IFlushTarget::Priority priority) +FlushEngine::wait_for_slot_or_pending_prune(IFlushTarget::Priority priority) { (void) priority; std::unique_lock<std::mutex> guard(_lock); @@ -183,7 +183,7 @@ FlushEngine::checkAndFlush(vespalib::string prev) { // Everything returned from a priority strategy should be flushed flushAll(lst.first); } else if ( ! lst.first.empty()) { - wait_for_slot(lst.first[0]->getTarget()->getPriority()); + wait_for_slot_or_pending_prune(lst.first[0]->getTarget()->getPriority()); prev = flushNextTarget(prev, lst.first); if (!prev.empty()) { // Sleep 1 ms after a successful flush in order to avoid busy loop in case @@ -202,9 +202,9 @@ FlushEngine::run() vespalib::string prevFlushName; for (vespalib::duration idleInterval=vespalib::duration::zero(); !_closed.load(std::memory_order_relaxed); idleInterval = _idleInterval) { LOG(debug, "Making another check for something to flush, last was '%s'", prevFlushName.c_str()); + wait_for_slot_or_pending_prune(IFlushTarget::Priority::HIGH); if (prune()) { // Prune attempted on one or more handlers - wait_for_slot(IFlushTarget::Priority::NORMAL); } else { auto [needWait, name] = checkAndFlush(prevFlushName); prevFlushName = name; diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h index 06ce34bb831..079d36dd530 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h @@ -82,7 +82,7 @@ private: uint32_t initFlush(const IFlushHandler::SP &handler, const IFlushTarget::SP &target); void flushDone(const FlushContext &ctx, uint32_t taskId); bool canFlushMore(const std::unique_lock<std::mutex> &guard) const; - void wait_for_slot(IFlushTarget::Priority priority); + void wait_for_slot_or_pending_prune(IFlushTarget::Priority priority); bool wait(vespalib::duration minimumWaitTimeIfReady, bool ignorePendingPrune); void wait(vespalib::duration minimumWaitTimeIfReady) { wait(minimumWaitTimeIfReady, false); |