summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@oath.com>2017-12-11 16:59:01 +0100
committerGitHub <noreply@github.com>2017-12-11 16:59:01 +0100
commite2ed5eeb21a966ec974b9ede020cfa8dfac17083 (patch)
tree79dd660fc38e10d5707e4b27645c5bab9c30c736
parent74f4f321357c0349614ee68c6073a07f40d82e11 (diff)
parent375aa1d3bdfda118b586393302a82cdd336bb0de (diff)
Merge pull request #4410 from vespa-engine/toregge/use-standard-locking-in-searchcore
Toregge/use standard locking in searchcore
-rw-r--r--searchcore/src/tests/proton/flushengine/flushengine.cpp10
-rw-r--r--searchcore/src/tests/proton/index/indexmanager_test.cpp4
-rw-r--r--searchcore/src/tests/proton/matchengine/matchengine.cpp22
-rw-r--r--searchcore/src/tests/proton/summaryengine/summaryengine.cpp24
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/feedtoken.h1
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/handlermap.hpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.h4
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_phase_limit_calculator.h1
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_phase_limiter.h1
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/matcher.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/matcher.h4
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/querylimiter.cpp12
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/querylimiter.h6
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/sessionmanager.cpp28
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/documentdb_job_trackers.h1
-rw-r--r--searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.h4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/removedonecontext.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp10
-rw-r--r--searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.h3
23 files changed, 82 insertions, 70 deletions
diff --git a/searchcore/src/tests/proton/flushengine/flushengine.cpp b/searchcore/src/tests/proton/flushengine/flushengine.cpp
index 985a970a380..d1a98f1b7d3 100644
--- a/searchcore/src/tests/proton/flushengine/flushengine.cpp
+++ b/searchcore/src/tests/proton/flushengine/flushengine.cpp
@@ -11,8 +11,8 @@
#include <vespa/searchcore/proton/test/dummy_flush_target.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/data/slime/slime.h>
-#include <vespa/vespalib/util/sync.h>
#include <vespa/vespalib/test/insertion_operators.h>
+#include <mutex>
#include <chrono>
#include <vespa/log/log.h>
@@ -123,7 +123,7 @@ public:
search::SerialNum _oldestSerial;
search::SerialNum _currentSerial;
uint32_t _pendingDone;
- vespalib::Lock _lock;
+ std::mutex _lock;
vespalib::CountDownLatch _done;
FlushDoneHistory _flushDoneHistory;
@@ -168,7 +168,7 @@ public:
// Called once by flush engine slave thread for each task done
void taskDone()
{
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
++_pendingDone;
}
@@ -178,7 +178,7 @@ public:
void
flushDone(search::SerialNum oldestSerial) override
{
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
LOG(info, "SimpleHandler(%s)::flushDone(%" PRIu64 ")",
getName().c_str(), oldestSerial);
_oldestSerial = std::max(_oldestSerial, oldestSerial);
@@ -191,7 +191,7 @@ public:
FlushDoneHistory getFlushDoneHistory()
{
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
return _flushDoneHistory;
}
};
diff --git a/searchcore/src/tests/proton/index/indexmanager_test.cpp b/searchcore/src/tests/proton/index/indexmanager_test.cpp
index e8afd738e84..6a098667be8 100644
--- a/searchcore/src/tests/proton/index/indexmanager_test.cpp
+++ b/searchcore/src/tests/proton/index/indexmanager_test.cpp
@@ -20,7 +20,6 @@
#include <vespa/searchlib/common/serialnum.h>
#include <vespa/searchlib/util/dirtraverse.h>
#include <vespa/vespalib/testkit/testapp.h>
-#include <vespa/vespalib/util/sync.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/vespalib/util/blockingthreadstackexecutor.h>
#include <vespa/vespalib/io/fileutil.h>
@@ -50,9 +49,6 @@ using search::queryeval::Source;
using std::set;
using std::string;
using vespalib::BlockingThreadStackExecutor;
-using vespalib::Gate;
-using vespalib::Monitor;
-using vespalib::MonitorGuard;
using vespalib::ThreadStackExecutor;
using namespace proton;
diff --git a/searchcore/src/tests/proton/matchengine/matchengine.cpp b/searchcore/src/tests/proton/matchengine/matchengine.cpp
index d2ce4b14b9c..ccae9fa3d4f 100644
--- a/searchcore/src/tests/proton/matchengine/matchengine.cpp
+++ b/searchcore/src/tests/proton/matchengine/matchengine.cpp
@@ -3,6 +3,9 @@
#include <vespa/vespalib/data/slime/slime.h>
#include <vespa/searchlib/engine/docsumreply.h>
#include <vespa/vespalib/testkit/test_kit.h>
+#include <mutex>
+#include <condition_variable>
+#include <chrono>
using namespace proton;
using namespace search::engine;
@@ -34,23 +37,26 @@ public:
class LocalSearchClient : public SearchClient {
private:
- vespalib::Monitor _monitor;
- SearchReply::UP _reply;
+ std::mutex _lock;
+ std::condition_variable _cond;
+ SearchReply::UP _reply;
public:
LocalSearchClient();
~LocalSearchClient();
void searchDone(SearchReply::UP reply) override {
- vespalib::MonitorGuard guard(_monitor);
+ std::lock_guard<std::mutex> guard(_lock);
_reply = std::move(reply);
- guard.broadcast();
+ _cond.notify_all();
}
SearchReply::UP getReply(uint32_t millis) {
- vespalib::MonitorGuard guard(_monitor);
- vespalib::TimedWaiter waiter(guard, millis);
- while (_reply.get() == NULL && waiter.hasTime()) {
- waiter.wait();
+ std::unique_lock<std::mutex> guard(_lock);
+ auto deadline = std::chrono::steady_clock::now() + std::chrono::milliseconds(millis);
+ while (!_reply) {
+ if (_cond.wait_until(guard, deadline) == std::cv_status::timeout) {
+ break;
+ }
}
return std::move(_reply);
}
diff --git a/searchcore/src/tests/proton/summaryengine/summaryengine.cpp b/searchcore/src/tests/proton/summaryengine/summaryengine.cpp
index db707e4aa97..4951b1cd569 100644
--- a/searchcore/src/tests/proton/summaryengine/summaryengine.cpp
+++ b/searchcore/src/tests/proton/summaryengine/summaryengine.cpp
@@ -9,8 +9,11 @@
#include <vespa/vespalib/util/compressor.h>
#include <vespa/searchlib/common/transport.h>
#include <vespa/fnet/frt/rpcrequest.h>
-#include <vespa/log/log.h>
+#include <mutex>
+#include <condition_variable>
+#include <chrono>
+#include <vespa/log/log.h>
LOG_SETUP("summaryengine_test");
using namespace search::engine;
@@ -81,8 +84,9 @@ public:
class MyDocsumClient : public DocsumClient {
private:
- vespalib::Monitor _monitor;
- DocsumReply::UP _reply;
+ std::mutex _lock;
+ std::condition_variable _cond;
+ DocsumReply::UP _reply;
public:
MyDocsumClient();
@@ -90,16 +94,18 @@ public:
~MyDocsumClient();
void getDocsumsDone(DocsumReply::UP reply) override {
- vespalib::MonitorGuard guard(_monitor);
+ std::lock_guard<std::mutex> guard(_lock);
_reply = std::move(reply);
- guard.broadcast();
+ _cond.notify_all();
}
DocsumReply::UP getReply(uint32_t millis) {
- vespalib::MonitorGuard guard(_monitor);
- vespalib::TimedWaiter waiter(guard, millis);
- while (_reply.get() == NULL && waiter.hasTime()) {
- waiter.wait();
+ std::unique_lock<std::mutex> guard(_lock);
+ auto deadline = std::chrono::steady_clock::now() + std::chrono::milliseconds(millis);
+ while (!_reply) {
+ if (_cond.wait_until(guard, deadline) == std::cv_status::timeout) {
+ break;
+ }
}
return std::move(_reply);
}
diff --git a/searchcore/src/vespa/searchcore/proton/common/feedtoken.h b/searchcore/src/vespa/searchcore/proton/common/feedtoken.h
index bc7e249ca3b..ab3fdea3345 100644
--- a/searchcore/src/vespa/searchcore/proton/common/feedtoken.h
+++ b/searchcore/src/vespa/searchcore/proton/common/feedtoken.h
@@ -3,7 +3,6 @@
#include <vespa/persistence/spi/persistenceprovider.h>
#include <vespa/searchlib/common/idestructorcallback.h>
-#include <vespa/vespalib/util/sync.h>
#include <atomic>
namespace proton {
diff --git a/searchcore/src/vespa/searchcore/proton/common/handlermap.hpp b/searchcore/src/vespa/searchcore/proton/common/handlermap.hpp
index 6b5d89cbd22..bddbfed371f 100644
--- a/searchcore/src/vespa/searchcore/proton/common/handlermap.hpp
+++ b/searchcore/src/vespa/searchcore/proton/common/handlermap.hpp
@@ -3,7 +3,6 @@
#include "doctypename.h"
#include <vespa/vespalib/util/exceptions.h>
-#include <vespa/vespalib/util/sync.h>
#include <vespa/vespalib/util/sequence.h>
#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/stllike/hash_map.h>
diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp
index 026cbc00604..6667db02173 100644
--- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp
+++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp
@@ -4,6 +4,8 @@
#include <vespa/searchlib/query/queryterm.h>
#include <vespa/searchlib/attribute/attributevector.h>
#include <vespa/searchlib/attribute/singlesmallnumericattribute.h>
+#include <mutex>
+
#include <vespa/log/log.h>
LOG_SETUP(".proton.documentmetastore.lid_allocator");
@@ -223,7 +225,7 @@ class BlackListBlueprint : public SimpleLeafBlueprint
{
private:
AttributeVector::SearchContext::UP _searchCtx;
- vespalib::Lock _lock;
+ mutable std::mutex _lock;
mutable std::vector<search::fef::TermFieldMatchData *> _matchDataVector;
virtual SearchIterator::UP
@@ -235,7 +237,7 @@ private:
search::fef::TermFieldMatchData *tfmd =
new search::fef::TermFieldMatchData;
{
- vespalib::LockGuard lock(_lock);
+ std::lock_guard<std::mutex> lock(_lock);
_matchDataVector.push_back(tfmd);
}
return _searchCtx->createIterator(tfmd, strict);
diff --git a/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp b/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp
index adb14b11c71..05dc75146c7 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp
@@ -59,7 +59,7 @@ AttributeLimiter::toString(DiversityCutoffStrategy strategy)
SearchIterator::UP
AttributeLimiter::create_search(size_t want_hits, size_t max_group_size, bool strictSearch)
{
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
const uint32_t my_field_id = 0;
search::fef::MatchDataLayout layout;
auto my_handle = layout.allocTermField(my_field_id);
diff --git a/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.h b/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.h
index 67180da6a10..95f7bf4e42b 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.h
@@ -4,11 +4,11 @@
#include <vespa/searchlib/queryeval/searchable.h>
#include <vespa/vespalib/stllike/string.h>
-#include <vespa/vespalib/util/sync.h>
#include <vespa/searchlib/queryeval/searchiterator.h>
#include <vespa/searchlib/queryeval/blueprint.h>
#include <vespa/searchlib/fef/matchdata.h>
+#include <mutex>
namespace proton {
namespace matching {
@@ -43,7 +43,7 @@ private:
vespalib::string _attribute_name;
bool _descending;
vespalib::string _diversity_attribute;
- vespalib::Lock _lock;
+ std::mutex _lock;
std::vector<search::fef::MatchData::UP> _match_datas;
search::queryeval::Blueprint::UP _blueprint;
ssize_t _estimatedHits;
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_phase_limit_calculator.h b/searchcore/src/vespa/searchcore/proton/matching/match_phase_limit_calculator.h
index e9e69c35bd4..a0aefd150f5 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_phase_limit_calculator.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_phase_limit_calculator.h
@@ -4,7 +4,6 @@
#include "isearchcontext.h"
#include <vespa/vespalib/stllike/string.h>
-#include <vespa/vespalib/util/sync.h>
#include <vespa/searchlib/queryeval/searchiterator.h>
#include <vespa/searchlib/queryeval/blueprint.h>
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_phase_limiter.h b/searchcore/src/vespa/searchcore/proton/matching/match_phase_limiter.h
index bc7a8038974..165762d5356 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_phase_limiter.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_phase_limiter.h
@@ -7,7 +7,6 @@
#include <vespa/searchlib/queryeval/searchable.h>
#include <vespa/vespalib/stllike/string.h>
-#include <vespa/vespalib/util/sync.h>
#include <vespa/searchlib/queryeval/searchiterator.h>
#include <vespa/searchlib/queryeval/blueprint.h>
#include <atomic>
diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
index 2a3df5aeb52..bbe6f604e4e 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
@@ -152,7 +152,7 @@ Matcher::Matcher(const search::index::Schema &schema,
MatchingStats
Matcher::getStats()
{
- vespalib::LockGuard guard(_statsLock);
+ std::lock_guard<std::mutex> guard(_statsLock);
MatchingStats stats = std::move(_stats);
_stats = std::move(MatchingStats());
_stats.softDoomFactor(stats.softDoomFactor());
@@ -315,7 +315,7 @@ Matcher::match(const SearchRequest &request,
{
fastos::TimeStamp softLimit = uint64_t((1.0 - _rankSetup->getSoftTimeoutTailCost()) * request.getTimeout());
fastos::TimeStamp duration = request.getTimeUsed();
- vespalib::LockGuard guard(_statsLock);
+ std::lock_guard<std::mutex> guard(_statsLock);
_stats.add(my_stats);
if (my_stats.softDoomed()) {
LOG(info, "Triggered softtimeout limit=%1.3f and duration=%1.3f", softLimit.sec(), duration.sec());
diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.h b/searchcore/src/vespa/searchcore/proton/matching/matcher.h
index 42a74e3c29b..8415f659473 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/matcher.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.h
@@ -15,8 +15,8 @@
#include <vespa/searchlib/query/base.h>
#include <vespa/vespalib/util/clock.h>
#include <vespa/vespalib/util/closure.h>
-#include <vespa/vespalib/util/sync.h>
#include <vespa/vespalib/util/thread_bundle.h>
+#include <mutex>
namespace search {
namespace grouping {
@@ -52,7 +52,7 @@ private:
search::fef::BlueprintFactory _blueprintFactory;
search::fef::RankSetup::SP _rankSetup;
ViewResolver _viewResolver;
- vespalib::Lock _statsLock;
+ std::mutex _statsLock;
MatchingStats _stats;
const vespalib::Clock &_clock;
QueryLimiter &_queryLimiter;
diff --git a/searchcore/src/vespa/searchcore/proton/matching/querylimiter.cpp b/searchcore/src/vespa/searchcore/proton/matching/querylimiter.cpp
index 0184d3634de..0d985496d41 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/querylimiter.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/querylimiter.cpp
@@ -1,5 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "querylimiter.h"
+#include <chrono>
namespace proton {
namespace matching {
@@ -18,11 +19,11 @@ QueryLimiter::LimitedToken::~LimitedToken()
void
QueryLimiter::grabToken(const Doom & doom)
{
- vespalib::MonitorGuard guard(_monitor);
+ std::unique_lock<std::mutex> guard(_lock);
while ((_maxThreads > 0) && (_activeThreads >= _maxThreads) && !doom.doom()) {
int left = doom.left().ms();
if (left > 0) {
- guard.wait(left);
+ _cond.wait_for(guard, std::chrono::milliseconds(left));
}
}
_activeThreads++;
@@ -31,13 +32,14 @@ QueryLimiter::grabToken(const Doom & doom)
void
QueryLimiter::releaseToken()
{
- vespalib::MonitorGuard guard(_monitor);
+ std::lock_guard<std::mutex> guard(_lock);
_activeThreads--;
- guard.signal();
+ _cond.notify_one();
}
QueryLimiter::QueryLimiter() :
- _monitor(),
+ _lock(),
+ _cond(),
_activeThreads(0),
_maxThreads(-1),
_coverage(1.0),
diff --git a/searchcore/src/vespa/searchcore/proton/matching/querylimiter.h b/searchcore/src/vespa/searchcore/proton/matching/querylimiter.h
index e34ae303df2..fbe8526b051 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/querylimiter.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/querylimiter.h
@@ -3,8 +3,9 @@
#pragma once
#include <memory>
-#include <vespa/vespalib/util/sync.h>
#include <vespa/vespalib/util/doom.h>
+#include <mutex>
+#include <condition_variable>
namespace proton {
namespace matching {
@@ -35,7 +36,8 @@ private:
};
void grabToken(const Doom & doom);
void releaseToken();
- vespalib::Monitor _monitor;
+ std::mutex _lock;
+ std::condition_variable _cond;
volatile int _activeThreads;
// These are updated asynchronously at reconfig.
diff --git a/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.cpp b/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.cpp
index b6c6c798506..afaf61cab5d 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.cpp
@@ -3,7 +3,7 @@
#include "sessionmanager.h"
#include <vespa/vespalib/stllike/lrucache_map.hpp>
#include <vespa/vespalib/stllike/hash_map.hpp>
-#include <vespa/vespalib/util/sync.h>
+#include <mutex>
#include <algorithm>
#include <vespa/log/log.h>
@@ -18,7 +18,7 @@ using Stats = SessionManager::Stats;
struct SessionCacheBase {
protected:
Stats _stats;
- vespalib::Lock _lock;
+ mutable std::mutex _lock;
void entryDropped(const SessionId &id);
~SessionCacheBase() {}
@@ -32,7 +32,7 @@ struct SessionCache : SessionCacheBase {
SessionCache(uint32_t max_size) : _cache(max_size) {}
void insert(EntryUP session) {
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
const SessionId &id(session->getSessionId());
if (_cache.size() >= _cache.capacity()) {
entryDropped(id);
@@ -41,7 +41,7 @@ struct SessionCache : SessionCacheBase {
_stats.numInsert++;
}
EntryUP pick(const SessionId & id) {
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
EntryUP ret;
if (_cache.hasKey(id)) {
_stats.numPick++;
@@ -56,7 +56,7 @@ struct SessionCache : SessionCacheBase {
}
std::vector<EntryUP> stealTimedOutSessions(fastos::TimeStamp currentTime) {
std::vector<EntryUP> toDestruct;
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
toDestruct.reserve(_cache.size());
for (auto it(_cache.begin()), mt(_cache.end()); it != mt;) {
auto &session = *it;
@@ -71,14 +71,14 @@ struct SessionCache : SessionCacheBase {
return toDestruct;
}
Stats getStats() {
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
Stats stats = _stats;
stats.numCached = _cache.size();
_stats = Stats();
return stats;
}
bool empty() const {
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
return _cache.empty();
}
};
@@ -89,13 +89,13 @@ struct SessionMap : SessionCacheBase {
vespalib::hash_map<SessionId, EntrySP> _map;
void insert(EntrySP session) {
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
const SessionId &id(session->getSessionId());
_map.insert(std::make_pair(id, session));
_stats.numInsert++;
}
EntrySP pick(const SessionId & id) {
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
auto it = _map.find(id);
if (it != _map.end()) {
_stats.numPick++;
@@ -110,7 +110,7 @@ struct SessionMap : SessionCacheBase {
std::vector<EntrySP> stealTimedOutSessions(fastos::TimeStamp currentTime) {
std::vector<EntrySP> toDestruct;
std::vector<SessionId> keys;
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
keys.reserve(_map.size());
toDestruct.reserve(_map.size());
for (auto & it : _map) {
@@ -128,23 +128,23 @@ struct SessionMap : SessionCacheBase {
return toDestruct;
}
Stats getStats() {
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
Stats stats = _stats;
stats.numCached = _map.size();
_stats = Stats();
return stats;
}
size_t size() const {
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
return _map.size();
}
bool empty() const {
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
return _map.empty();
}
template <typename F>
void each(F f) const {
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
for (const auto &entry: _map) {
f(*entry.second);
}
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_job_trackers.h b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_job_trackers.h
index 4dfcbe89d68..67f8e6dcacf 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_job_trackers.h
+++ b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_job_trackers.h
@@ -4,7 +4,6 @@
#include "documentdb_tagged_metrics.h"
#include "job_tracker.h"
#include <vespa/searchcorespi/flush/iflushtarget.h>
-#include <vespa/vespalib/util/sync.h>
#include <chrono>
#include <mutex>
diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.cpp b/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.cpp
index 12ba5e7ab29..96025f5eaad 100644
--- a/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.cpp
+++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.cpp
@@ -20,7 +20,7 @@ void
TransportLatch::send(ResultUP result, bool documentWasFound)
{
{
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
if (!_result) {
_result = std::move(result);
} else if (result->hasError()) {
diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.h b/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.h
index 10dae553a80..27b9ffa9b88 100644
--- a/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.h
+++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.h
@@ -4,6 +4,8 @@
#include <vespa/persistence/spi/result.h>
#include <vespa/searchcore/proton/common/feedtoken.h>
#include <vespa/vespalib/util/sequence.h>
+#include <vespa/vespalib/util/sync.h>
+#include <mutex>
namespace proton {
@@ -17,7 +19,7 @@ private:
using UpdateResult = storage::spi::UpdateResult;
using RemoveResult = storage::spi::RemoveResult;
vespalib::CountDownLatch _latch;
- vespalib::Lock _lock;
+ std::mutex _lock;
ResultUP _result;
public:
diff --git a/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp b/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp
index 8091196cc4b..a5523083df7 100644
--- a/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp
@@ -2,7 +2,6 @@
#include "executorthreadingservice.h"
#include <vespa/vespalib/util/executor.h>
-#include <vespa/vespalib/util/sync.h>
using vespalib::ThreadStackExecutorBase;
diff --git a/searchcore/src/vespa/searchcore/proton/server/removedonecontext.cpp b/searchcore/src/vespa/searchcore/proton/server/removedonecontext.cpp
index 194e190bb7b..3d770fad313 100644
--- a/searchcore/src/vespa/searchcore/proton/server/removedonecontext.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/removedonecontext.cpp
@@ -3,6 +3,7 @@
#include "removedonecontext.h"
#include "removedonetask.h"
#include <vespa/searchcore/proton/reference/i_gid_to_lid_change_handler.h>
+#include <cassert>
namespace proton {
diff --git a/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp b/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp
index cda1d0103c7..30e9382ae14 100644
--- a/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp
+++ b/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp
@@ -51,7 +51,7 @@ SummaryEngine::close()
{
LOG(debug, "Closing summary engine");
{
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
_closed = true;
}
LOG(debug, "Handshaking with task manager");
@@ -61,21 +61,21 @@ SummaryEngine::close()
ISearchHandler::SP
SummaryEngine::putSearchHandler(const DocTypeName &docTypeName, const ISearchHandler::SP & searchHandler)
{
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
return _handlers.putHandler(docTypeName, searchHandler);
}
ISearchHandler::SP
SummaryEngine::getSearchHandler(const DocTypeName &docTypeName)
{
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
return _handlers.getHandler(docTypeName);
}
ISearchHandler::SP
SummaryEngine::removeSearchHandler(const DocTypeName &docTypeName)
{
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
return _handlers.removeHandler(docTypeName);
}
@@ -107,7 +107,7 @@ SummaryEngine::getDocsums(DocsumRequest::UP req)
} else {
vespalib::Sequence<ISearchHandler*>::UP snapshot;
{
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
snapshot = _handlers.snapshot();
}
if (snapshot->valid()) {
diff --git a/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.h b/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.h
index d599f1521ec..2420a656909 100644
--- a/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.h
+++ b/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.h
@@ -6,6 +6,7 @@
#include <vespa/searchlib/engine/docsumapi.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/searchcore/proton/common/doctypename.h>
+#include <mutex>
namespace proton {
@@ -16,7 +17,7 @@ private:
using DocsumRequest = search::engine::DocsumRequest;
using DocsumClient = search::engine::DocsumClient;
- vespalib::Lock _lock;
+ std::mutex _lock;
bool _closed;
HandlerMap<ISearchHandler> _handlers;
vespalib::ThreadStackExecutor _executor;