From ea85e10adc727553a2b78f3634340912f184da06 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Mon, 8 May 2023 06:34:46 +0000 Subject: Wait for a pending prune or a high priority slot before continuing. --- searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp | 6 +++--- 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 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 &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); -- cgit v1.2.3