diff options
Diffstat (limited to 'searchcore')
3 files changed, 7 insertions, 6 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp index fb0b114d4b3..95b3008985b 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp @@ -231,12 +231,12 @@ FlushEngine::getTargetList(bool includeFlushingTargets) const } std::pair<FlushContext::List,bool> -FlushEngine::getSortedTargetList(const std::lock_guard<std::mutex> &strategyGuard) const +FlushEngine::getSortedTargetList() { - (void) strategyGuard; FlushContext::List unsortedTargets = getTargetList(false); - std::pair<FlushContext::List, bool> ret; flushengine::TlsStatsMap tlsStatsMap(_tlsStatsFactory->create()); + std::lock_guard<std::mutex> strategyGuard(_strategyLock); + std::pair<FlushContext::List, bool> ret; if (_priorityStrategy) { ret = std::make_pair(_priorityStrategy->getFlushTargets(unsortedTargets, tlsStatsMap), true); } else { @@ -295,13 +295,13 @@ FlushEngine::flushAll(const FlushContext::List &lst) vespalib::string FlushEngine::flushNextTarget(const vespalib::string & name) { - std::lock_guard<std::mutex> strategyGuard(_strategyLock); - std::pair<FlushContext::List,bool> lst = getSortedTargetList(strategyGuard); + std::pair<FlushContext::List,bool> lst = getSortedTargetList(); if (lst.second) { // Everything returned from a priority strategy should be flushed flushAll(lst.first); _executor.sync(); prune(); + std::lock_guard<std::mutex> strategyGuard(_strategyLock); _priorityStrategy.reset(); _strategyCond.notify_all(); return ""; diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h index 7346810c5a5..19175f9ce2a 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h @@ -65,7 +65,7 @@ private: std::set<IFlushHandler::SP> _pendingPrune; FlushContext::List getTargetList(bool includeFlushingTargets) const; - std::pair<FlushContext::List,bool> getSortedTargetList(const std::lock_guard<std::mutex> &strategyGuard) const; + std::pair<FlushContext::List,bool> getSortedTargetList(); FlushContext::SP initNextFlush(const FlushContext::List &lst); vespalib::string flushNextTarget(const vespalib::string & name); void flushAll(const FlushContext::List &lst); diff --git a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp index d77be520351..2d8368e091b 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp @@ -394,6 +394,7 @@ FeedHandler::flushDone(SerialNum flushedSerial) { // Called by flush scheduler thread after flush worker thread has completed a flush task _writeService.master().execute(makeLambdaTask([this, flushedSerial]() { performFlushDone(flushedSerial); })); + _writeService.master().sync(); } |