aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp2
-rw-r--r--slobrok/src/tests/mirrorapi/mirrorapi.cpp2
-rw-r--r--slobrok/src/vespa/slobrok/cfg.h4
-rw-r--r--slobrok/src/vespa/slobrok/sbmirror.cpp6
-rw-r--r--slobrok/src/vespa/slobrok/sbmirror.h2
-rw-r--r--storage/src/tests/common/dummystoragelink.cpp10
-rw-r--r--storage/src/tests/common/dummystoragelink.h16
-rw-r--r--storage/src/tests/common/teststorageapp.cpp2
-rw-r--r--storage/src/tests/common/teststorageapp.h8
-rw-r--r--storage/src/tests/storageserver/testvisitormessagesession.h9
-rw-r--r--storage/src/tests/visiting/visitormanagertest.cpp2
-rw-r--r--storage/src/tests/visiting/visitortest.cpp4
-rw-r--r--storage/src/vespa/storage/distributor/distributor.cpp10
-rw-r--r--storage/src/vespa/storage/distributor/distributor.h4
-rw-r--r--storage/src/vespa/storage/distributor/distributorcomponent.h1
-rw-r--r--storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.cpp12
-rw-r--r--storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h2
-rw-r--r--storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.cpp4
-rw-r--r--storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h2
-rw-r--r--storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.cpp18
-rw-r--r--storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h2
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.cpp10
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h2
-rw-r--r--storage/src/vespa/storage/storageserver/bouncer.cpp6
-rw-r--r--storage/src/vespa/storage/storageserver/bouncer.h5
-rw-r--r--storage/src/vespa/storage/storageserver/changedbucketownershiphandler.cpp8
-rw-r--r--storage/src/vespa/storage/storageserver/changedbucketownershiphandler.h5
-rw-r--r--storage/src/vespa/storage/storageserver/communicationmanager.cpp4
-rw-r--r--storage/src/vespa/storage/storageserver/communicationmanager.h2
-rw-r--r--storage/src/vespa/storage/storageserver/opslogger.cpp10
-rw-r--r--storage/src/vespa/storage/storageserver/opslogger.h9
-rw-r--r--storage/src/vespa/storage/storageserver/priorityconverter.cpp4
-rw-r--r--storage/src/vespa/storage/storageserver/priorityconverter.h6
-rw-r--r--storage/src/vespa/storage/storageserver/rpc/shared_rpc_resources.cpp4
-rw-r--r--storage/src/vespa/storage/storageserver/servicelayernode.cpp2
-rw-r--r--storage/src/vespa/storage/storageserver/statemanager.cpp6
-rw-r--r--storage/src/vespa/storage/storageserver/statemanager.h2
-rw-r--r--storage/src/vespa/storage/storageserver/storagenode.cpp18
-rw-r--r--storage/src/vespa/storage/storageserver/storagenode.h2
-rw-r--r--storage/src/vespa/storage/visiting/recoveryvisitor.cpp4
-rw-r--r--storage/src/vespa/storage/visiting/recoveryvisitor.h2
-rw-r--r--storage/src/vespa/storage/visiting/visitormanager.cpp2
-rw-r--r--storage/src/vespa/storage/visiting/visitormanager.h5
-rw-r--r--vespaclient/src/vespa/vespaclient/vdsstates/statesapp.cpp4
44 files changed, 116 insertions, 128 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp
index 62ffdb3e5a8..428aba1a6b5 100644
--- a/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/rpc_hooks.cpp
@@ -200,7 +200,7 @@ RPCHooksBase::RPCHooksBase(Params &params)
_proton.get_search_server(),
_proton.get_docsum_server(),
_proton.get_monitor_server(), *_orb)),
- _regAPI(*_orb, params.slobrok_config),
+ _regAPI(*_orb, slobrok::ConfiguratorFactory(params.slobrok_config)),
_stateLock(),
_stateCond(),
_executor(48, 128 * 1024)
diff --git a/slobrok/src/tests/mirrorapi/mirrorapi.cpp b/slobrok/src/tests/mirrorapi/mirrorapi.cpp
index 53e194fad2d..4126f34716f 100644
--- a/slobrok/src/tests/mirrorapi/mirrorapi.cpp
+++ b/slobrok/src/tests/mirrorapi/mirrorapi.cpp
@@ -140,7 +140,7 @@ Test::Main()
FastOS_ThreadPool threadPool(0x10000);
FNET_Transport transport;
FRT_Supervisor supervisor(&transport);
- MirrorAPI mirror(supervisor, config::ConfigUri::createFromInstance(specBuilder));
+ MirrorAPI mirror(supervisor, slobrok::ConfiguratorFactory(config::ConfigUri::createFromInstance(specBuilder)));
EXPECT_TRUE(!mirror.ready());
transport.Start(&threadPool);
std::this_thread::sleep_for(1s);
diff --git a/slobrok/src/vespa/slobrok/cfg.h b/slobrok/src/vespa/slobrok/cfg.h
index 173f08c3227..db83790677a 100644
--- a/slobrok/src/vespa/slobrok/cfg.h
+++ b/slobrok/src/vespa/slobrok/cfg.h
@@ -31,9 +31,9 @@ class ConfiguratorFactory {
private:
config::ConfigUri _uri;
public:
- ConfiguratorFactory(const config::ConfigUri & uri);
+ explicit ConfiguratorFactory(const config::ConfigUri & uri);
// Convenience. Might belong somewhere else
- ConfiguratorFactory(const std::vector<std::string> & spec);
+ explicit ConfiguratorFactory(const std::vector<std::string> & spec);
Configurator::UP create(Configurable &target) const;
};
diff --git a/slobrok/src/vespa/slobrok/sbmirror.cpp b/slobrok/src/vespa/slobrok/sbmirror.cpp
index f0a810dad10..855ed4dd82d 100644
--- a/slobrok/src/vespa/slobrok/sbmirror.cpp
+++ b/slobrok/src/vespa/slobrok/sbmirror.cpp
@@ -55,7 +55,7 @@ MirrorAPI::SpecList
MirrorAPI::lookup(const std::string & pattern) const
{
SpecList ret;
- LockGuard guard(_lock);
+ std::lock_guard guard(_lock);
SpecList::const_iterator end = _specs.end();
for (SpecList::const_iterator it = _specs.begin(); it != end; ++it) {
if (match(it->first.c_str(), pattern.c_str())) {
@@ -104,7 +104,7 @@ void
MirrorAPI::updateTo(SpecList& newSpecs, uint32_t newGen)
{
{
- LockGuard guard(_lock);
+ std::lock_guard guard(_lock);
std::swap(newSpecs, _specs);
_updates.add();
}
@@ -117,7 +117,7 @@ MirrorAPI::updateTo(SpecList& newSpecs, uint32_t newGen)
bool
MirrorAPI::ready() const
{
- LockGuard guard(_lock);
+ std::lock_guard guard(_lock);
return _updates.getAsInt() != 0;
}
diff --git a/slobrok/src/vespa/slobrok/sbmirror.h b/slobrok/src/vespa/slobrok/sbmirror.h
index 152886fc02e..437ef334af6 100644
--- a/slobrok/src/vespa/slobrok/sbmirror.h
+++ b/slobrok/src/vespa/slobrok/sbmirror.h
@@ -88,7 +88,7 @@ private:
void reSched(double seconds);
FRT_Supervisor &_orb;
- mutable vespalib::Lock _lock;
+ mutable std::mutex _lock;
bool _reqPending;
bool _scheduled;
bool _reqDone;
diff --git a/storage/src/tests/common/dummystoragelink.cpp b/storage/src/tests/common/dummystoragelink.cpp
index 05ef0df432a..ab70bff3409 100644
--- a/storage/src/tests/common/dummystoragelink.cpp
+++ b/storage/src/tests/common/dummystoragelink.cpp
@@ -37,7 +37,7 @@ DummyStorageLink::~DummyStorageLink()
bool
DummyStorageLink::handleInjectedReply()
{
- vespalib::LockGuard guard(_lock);
+ std::lock_guard guard(_lock);
if (!_injected.empty()) {
sendUp(*_injected.begin());
_injected.pop_front();
@@ -65,7 +65,7 @@ bool DummyStorageLink::onDown(const api::StorageMessage::SP& cmd)
if (isBottom()) {
vespalib::MonitorGuard lock(_waitMonitor);
{
- vespalib::LockGuard guard(_lock);
+ std::lock_guard guard(_lock);
_commands.push_back(cmd);
}
lock.broadcast();
@@ -78,7 +78,7 @@ bool DummyStorageLink::onUp(const api::StorageMessage::SP& reply) {
if (isTop()) {
vespalib::MonitorGuard lock(_waitMonitor);
{
- vespalib::LockGuard guard(_lock);
+ std::lock_guard guard(_lock);
_replies.push_back(reply);
}
lock.broadcast();
@@ -91,13 +91,13 @@ bool DummyStorageLink::onUp(const api::StorageMessage::SP& reply) {
void DummyStorageLink::injectReply(api::StorageReply* reply)
{
assert(reply);
- vespalib::LockGuard guard(_lock);
+ std::lock_guard guard(_lock);
_injected.push_back(std::shared_ptr<api::StorageReply>(reply));
}
void DummyStorageLink::reset() {
vespalib::MonitorGuard lock(_waitMonitor);
- vespalib::LockGuard guard(_lock);
+ std::lock_guard guard(_lock);
_commands.clear();
_replies.clear();
_injected.clear();
diff --git a/storage/src/tests/common/dummystoragelink.h b/storage/src/tests/common/dummystoragelink.h
index 174f8219560..46a1d4ea25f 100644
--- a/storage/src/tests/common/dummystoragelink.h
+++ b/storage/src/tests/common/dummystoragelink.h
@@ -18,7 +18,7 @@ namespace storage {
class DummyStorageLink : public StorageLink {
- mutable vespalib::Lock _lock; // to protect below containers:
+ mutable std::mutex _lock; // to protect below containers:
std::vector<api::StorageMessage::SP> _commands;
std::vector<api::StorageMessage::SP> _replies;
std::list<api::StorageMessage::SP> _injected;
@@ -31,7 +31,7 @@ class DummyStorageLink : public StorageLink {
public:
DummyStorageLink();
- ~DummyStorageLink();
+ ~DummyStorageLink() override;
bool onDown(const api::StorageMessage::SP&) override;
bool onUp(const api::StorageMessage::SP&) override;
@@ -63,21 +63,21 @@ public:
void waitForMessage(const api::MessageType&, int timeout = -1);
api::StorageMessage::SP getCommand(size_t i) const {
- vespalib::LockGuard guard(_lock);
+ std::lock_guard guard(_lock);
api::StorageMessage::SP ret = _commands[i];
return ret;
}
api::StorageMessage::SP getReply(size_t i) const {
- vespalib::LockGuard guard(_lock);
+ std::lock_guard guard(_lock);
api::StorageMessage::SP ret = _replies[i];
return ret;
}
size_t getNumCommands() const {
- vespalib::LockGuard guard(_lock);
+ std::lock_guard guard(_lock);
return _commands.size();
}
size_t getNumReplies() const {
- vespalib::LockGuard guard(_lock);
+ std::lock_guard guard(_lock);
return _replies.size();
}
@@ -90,7 +90,7 @@ public:
vespalib::MonitorGuard lock(_waitMonitor);
std::vector<api::StorageMessage::SP> retval;
{
- vespalib::LockGuard guard(_lock);
+ std::lock_guard guard(_lock);
retval.swap(_commands);
}
return retval;
@@ -100,7 +100,7 @@ public:
vespalib::MonitorGuard lock(_waitMonitor);
std::vector<api::StorageMessage::SP> retval;
{
- vespalib::LockGuard guard(_lock);
+ std::lock_guard guard(_lock);
retval.swap(_replies);
}
return retval;
diff --git a/storage/src/tests/common/teststorageapp.cpp b/storage/src/tests/common/teststorageapp.cpp
index c03e17138e0..f2989f88765 100644
--- a/storage/src/tests/common/teststorageapp.cpp
+++ b/storage/src/tests/common/teststorageapp.cpp
@@ -257,7 +257,7 @@ TestDistributorApp::~TestDistributorApp() = default;
api::Timestamp
TestDistributorApp::getUniqueTimestamp()
{
- vespalib::LockGuard guard(_accessLock);
+ std::lock_guard guard(_accessLock);
uint64_t timeNow(getClock().getTimeInSeconds().getTime());
if (timeNow == _lastUniqueTimestampRequested) {
++_uniqueTimestampCounter;
diff --git a/storage/src/tests/common/teststorageapp.h b/storage/src/tests/common/teststorageapp.h
index 218e7352f04..03936d37788 100644
--- a/storage/src/tests/common/teststorageapp.h
+++ b/storage/src/tests/common/teststorageapp.h
@@ -141,16 +141,16 @@ class TestDistributorApp : public TestStorageApp,
public UniqueTimeCalculator
{
DistributorComponentRegisterImpl& _compReg;
- vespalib::Lock _accessLock;
+ std::mutex _accessLock;
uint64_t _lastUniqueTimestampRequested;
uint32_t _uniqueTimestampCounter;
void configure(vespalib::stringref configId);
public:
- TestDistributorApp(vespalib::stringref configId = "");
- TestDistributorApp(NodeIndex index, vespalib::stringref configId = "");
- ~TestDistributorApp();
+ explicit TestDistributorApp(vespalib::stringref configId = "");
+ explicit TestDistributorApp(NodeIndex index, vespalib::stringref configId = "");
+ ~TestDistributorApp() override;
DistributorComponentRegisterImpl& getComponentRegister() {
return _compReg;
diff --git a/storage/src/tests/storageserver/testvisitormessagesession.h b/storage/src/tests/storageserver/testvisitormessagesession.h
index a9d83ca6c1a..1cea1c78d74 100644
--- a/storage/src/tests/storageserver/testvisitormessagesession.h
+++ b/storage/src/tests/storageserver/testvisitormessagesession.h
@@ -45,7 +45,7 @@ public:
struct TestVisitorMessageSessionFactory : public VisitorMessageSessionFactory
{
- vespalib::Lock _accessLock;
+ std::mutex _accessLock;
std::vector<TestVisitorMessageSession*> _visitorSessions;
mbus::Error _autoReplyError;
bool _createAutoReplyVisitorSessions;
@@ -56,11 +56,10 @@ struct TestVisitorMessageSessionFactory : public VisitorMessageSessionFactory
_priConverter(configId) {}
VisitorMessageSession::UP createSession(Visitor& v, VisitorThread& vt) override {
- vespalib::LockGuard lock(_accessLock);
- TestVisitorMessageSession::UP session(new TestVisitorMessageSession(vt, v, _autoReplyError,
- _createAutoReplyVisitorSessions));
+ std::lock_guard lock(_accessLock);
+ auto session = std::make_unique<TestVisitorMessageSession>(vt, v, _autoReplyError, _createAutoReplyVisitorSessions);
_visitorSessions.push_back(session.get());
- return VisitorMessageSession::UP(std::move(session));
+ return session;
}
documentapi::Priority::Value toDocumentPriority(uint8_t storagePriority) const override {
diff --git a/storage/src/tests/visiting/visitormanagertest.cpp b/storage/src/tests/visiting/visitormanagertest.cpp
index 20934d04eaa..0ce305fb8bb 100644
--- a/storage/src/tests/visiting/visitormanagertest.cpp
+++ b/storage/src/tests/visiting/visitormanagertest.cpp
@@ -223,7 +223,7 @@ VisitorManagerTest::getSession(uint32_t n)
framework::MilliSecTime endTime(clock.getTimeInMillis() + framework::MilliSecTime(30 * 1000));
while (true) {
{
- vespalib::LockGuard lock(_messageSessionFactory->_accessLock);
+ std::lock_guard lock(_messageSessionFactory->_accessLock);
if (sessions.size() > n) {
return *sessions[n];
}
diff --git a/storage/src/tests/visiting/visitortest.cpp b/storage/src/tests/visiting/visitortest.cpp
index 16b2fca77ae..ee6b8fa3d38 100644
--- a/storage/src/tests/visiting/visitortest.cpp
+++ b/storage/src/tests/visiting/visitortest.cpp
@@ -1,9 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/document/datatype/datatype.h>
#include <vespa/document/fieldvalue/intfieldvalue.h>
#include <vespa/document/fieldvalue/stringfieldvalue.h>
-#include <vespa/document/fieldvalue/rawfieldvalue.h>
#include <vespa/document/test/make_bucket_space.h>
#include <vespa/storageapi/message/datagram.h>
#include <vespa/storageapi/message/persistence.h>
@@ -259,7 +257,7 @@ VisitorTest::getSession(uint32_t n)
clock.getTimeInMillis() + framework::MilliSecTime(30 * 1000));
while (true) {
{
- vespalib::LockGuard lock(_messageSessionFactory->_accessLock);
+ std::lock_guard lock(_messageSessionFactory->_accessLock);
if (sessions.size() > n) {
return *sessions[n];
}
diff --git a/storage/src/vespa/storage/distributor/distributor.cpp b/storage/src/vespa/storage/distributor/distributor.cpp
index e577d219f1b..352da70d7e4 100644
--- a/storage/src/vespa/storage/distributor/distributor.cpp
+++ b/storage/src/vespa/storage/distributor/distributor.cpp
@@ -465,7 +465,7 @@ BucketSpacesStatsProvider::BucketSpacesStats Distributor::make_invalid_stats_per
}
void Distributor::invalidate_bucket_spaces_stats() {
- vespalib::LockGuard guard(_metricLock);
+ std::lock_guard guard(_metricLock);
_bucketSpacesStats = BucketSpacesStatsProvider::PerNodeBucketSpacesStats();
auto invalid_space_stats = make_invalid_stats_per_configured_space();
@@ -681,21 +681,21 @@ void Distributor::startExternalOperations() {
std::unordered_map<uint16_t, uint32_t>
Distributor::getMinReplica() const
{
- vespalib::LockGuard guard(_metricLock);
+ std::lock_guard guard(_metricLock);
return _bucketDbStats._minBucketReplica;
}
BucketSpacesStatsProvider::PerNodeBucketSpacesStats
Distributor::getBucketSpacesStats() const
{
- vespalib::LockGuard guard(_metricLock);
+ std::lock_guard guard(_metricLock);
return _bucketSpacesStats;
}
void
Distributor::propagateInternalScanMetricsToExternal()
{
- vespalib::LockGuard guard(_metricLock);
+ std::lock_guard guard(_metricLock);
// All shared values are written when _metricLock is held, so no races.
if (_bucketDBMetricUpdater.hasCompletedRound()) {
@@ -755,7 +755,7 @@ bool merge_no_longer_pending_edge(const PerNodeBucketSpacesStats& prev_stats,
void
Distributor::updateInternalMetricsForCompletedScan()
{
- vespalib::LockGuard guard(_metricLock);
+ std::lock_guard guard(_metricLock);
_bucketDBMetricUpdater.completeRound();
_bucketDbStats = _bucketDBMetricUpdater.getLastCompleteStats();
diff --git a/storage/src/vespa/storage/distributor/distributor.h b/storage/src/vespa/storage/distributor/distributor.h
index fcc08030764..d7dd1fda2e9 100644
--- a/storage/src/vespa/storage/distributor/distributor.h
+++ b/storage/src/vespa/storage/distributor/distributor.h
@@ -20,7 +20,6 @@
#include <vespa/storageapi/message/state.h>
#include <vespa/storageframework/generic/metric/metricupdatehook.h>
#include <vespa/storageframework/generic/thread/tickingthread.h>
-#include <vespa/vespalib/util/sync.h>
#include <queue>
#include <unordered_map>
@@ -301,7 +300,6 @@ private:
ClientRequestPriorityQueue _client_request_priority_queue;
MessageQueue _fetchedMessages;
framework::TickingThreadPool& _threadPool;
- vespalib::Monitor _statusMonitor;
mutable std::vector<std::shared_ptr<Status>> _statusToDo;
mutable std::vector<std::shared_ptr<Status>> _fetchedStatusRequests;
@@ -325,7 +323,7 @@ private:
BucketDBMetricUpdater _bucketDBMetricUpdater;
std::unique_ptr<BucketGcTimeCalculator::BucketIdHasher> _bucketIdHasher;
MetricUpdateHook _metricUpdateHook;
- vespalib::Lock _metricLock;
+ mutable std::mutex _metricLock;
/**
* Maintenance stats for last completed database scan iteration.
* Access must be protected by _metricLock as it is read by metric
diff --git a/storage/src/vespa/storage/distributor/distributorcomponent.h b/storage/src/vespa/storage/distributor/distributorcomponent.h
index df25efb3b00..283d0c20390 100644
--- a/storage/src/vespa/storage/distributor/distributorcomponent.h
+++ b/storage/src/vespa/storage/distributor/distributorcomponent.h
@@ -186,7 +186,6 @@ protected:
DistributorBucketSpaceRepo& _bucketSpaceRepo;
DistributorBucketSpaceRepo& _readOnlyBucketSpaceRepo;
- vespalib::Lock _sync;
};
}
diff --git a/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.cpp b/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.cpp
index 439bc9e078c..efd558a0b4b 100644
--- a/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.cpp
+++ b/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.cpp
@@ -1,6 +1,5 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "distributorcomponentregisterimpl.h"
-#include <vespa/vdslib/distribution/idealnodecalculatorimpl.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vdslib/state/cluster_state_bundle.h>
@@ -11,8 +10,7 @@ DistributorComponentRegisterImpl::DistributorComponentRegisterImpl()
{
}
-DistributorComponentRegisterImpl::~DistributorComponentRegisterImpl() {
-}
+DistributorComponentRegisterImpl::~DistributorComponentRegisterImpl() = default;
void
DistributorComponentRegisterImpl::handleNewState()
@@ -24,7 +22,7 @@ DistributorComponentRegisterImpl::handleNewState()
void
DistributorComponentRegisterImpl::registerDistributorComponent(DistributorManagedComponent& smc)
{
- vespalib::LockGuard lock(_componentLock);
+ std::lock_guard lock(_componentLock);
_components.push_back(&smc);
if (_timeCalculator != 0) {
smc.setTimeCalculator(*_timeCalculator);
@@ -36,7 +34,7 @@ DistributorComponentRegisterImpl::registerDistributorComponent(DistributorManage
void
DistributorComponentRegisterImpl::setTimeCalculator(UniqueTimeCalculator& utc)
{
- vespalib::LockGuard lock(_componentLock);
+ std::lock_guard lock(_componentLock);
if (_timeCalculator != 0) {
throw vespalib::IllegalStateException(
"Time calculator already set. Cannot be updated live",
@@ -51,7 +49,7 @@ DistributorComponentRegisterImpl::setTimeCalculator(UniqueTimeCalculator& utc)
void
DistributorComponentRegisterImpl::setDistributorConfig(const DistributorConfig& c)
{
- vespalib::LockGuard lock(_componentLock);
+ std::lock_guard lock(_componentLock);
_distributorConfig = c;
for (uint32_t i=0; i<_components.size(); ++i) {
_components[i]->setDistributorConfig(c);
@@ -61,7 +59,7 @@ DistributorComponentRegisterImpl::setDistributorConfig(const DistributorConfig&
void
DistributorComponentRegisterImpl::setVisitorConfig(const VisitorConfig& c)
{
- vespalib::LockGuard lock(_componentLock);
+ std::lock_guard lock(_componentLock);
_visitorConfig = c;
for (uint32_t i=0; i<_components.size(); ++i) {
_components[i]->setVisitorConfig(c);
diff --git a/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h b/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h
index 61fba7f9921..a6c678630e0 100644
--- a/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h
+++ b/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h
@@ -21,7 +21,7 @@ class DistributorComponentRegisterImpl
public virtual StorageComponentRegisterImpl,
private StateListener
{
- vespalib::Lock _componentLock;
+ std::mutex _componentLock;
std::vector<DistributorManagedComponent*> _components;
UniqueTimeCalculator* _timeCalculator;
diff --git a/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.cpp b/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.cpp
index da45b61701e..17e65478411 100644
--- a/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.cpp
+++ b/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.cpp
@@ -18,7 +18,7 @@ void
ServiceLayerComponentRegisterImpl::registerServiceLayerComponent(
ServiceLayerManagedComponent& smc)
{
- vespalib::LockGuard lock(_componentLock);
+ std::lock_guard lock(_componentLock);
_components.push_back(&smc);
smc.setDiskCount(_diskCount);
smc.setBucketSpaceRepo(_bucketSpaceRepo);
@@ -28,7 +28,7 @@ ServiceLayerComponentRegisterImpl::registerServiceLayerComponent(
void
ServiceLayerComponentRegisterImpl::setDiskCount(uint16_t count)
{
- vespalib::LockGuard lock(_componentLock);
+ std::lock_guard lock(_componentLock);
if (_diskCount != 0) {
throw IllegalStateException("Disk count already set. Cannot be updated live", VESPA_STRLOC);
}
diff --git a/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h b/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h
index 9988b861422..e722110d770 100644
--- a/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h
+++ b/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h
@@ -18,7 +18,7 @@ class ServiceLayerComponentRegisterImpl
: public virtual ServiceLayerComponentRegister,
public virtual StorageComponentRegisterImpl
{
- vespalib::Lock _componentLock;
+ std::mutex _componentLock;
std::vector<ServiceLayerManagedComponent*> _components;
uint16_t _diskCount;
ContentBucketSpaceRepo _bucketSpaceRepo;
diff --git a/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.cpp b/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.cpp
index daafa3541c5..9c421eb7f8f 100644
--- a/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.cpp
+++ b/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.cpp
@@ -30,7 +30,7 @@ StorageComponentRegisterImpl::~StorageComponentRegisterImpl() = default;
void
StorageComponentRegisterImpl::registerStorageComponent(StorageComponent& smc)
{
- vespalib::LockGuard lock(_componentLock);
+ std::lock_guard lock(_componentLock);
_components.push_back(&smc);
assert(_nodeType != nullptr);
smc.setNodeInfo(_clusterName, *_nodeType, _index);
@@ -49,7 +49,7 @@ StorageComponentRegisterImpl::setNodeInfo(vespalib::stringref clusterName,
const lib::NodeType& nodeType,
uint16_t index)
{
- vespalib::LockGuard lock(_componentLock);
+ std::lock_guard lock(_componentLock);
if (_nodeType != nullptr) {
LOG(warning, "Node info already set. May be valid in tests, but is a "
"bug in production. Node info should not be updated live");
@@ -62,7 +62,7 @@ StorageComponentRegisterImpl::setNodeInfo(vespalib::stringref clusterName,
void
StorageComponentRegisterImpl::setNodeStateUpdater(NodeStateUpdater& updater)
{
- vespalib::LockGuard lock(_componentLock);
+ std::lock_guard lock(_componentLock);
if (_nodeStateUpdater != 0) {
throw vespalib::IllegalStateException(
"Node state updater already set. Should never be altered live.",
@@ -77,7 +77,7 @@ StorageComponentRegisterImpl::setNodeStateUpdater(NodeStateUpdater& updater)
void
StorageComponentRegisterImpl::setDocumentTypeRepo(std::shared_ptr<const document::DocumentTypeRepo> repo)
{
- vespalib::LockGuard lock(_componentLock);
+ std::lock_guard lock(_componentLock);
_docTypeRepo = repo;
for (auto& component : _components) {
component->setDocumentTypeRepo(repo);
@@ -87,7 +87,7 @@ StorageComponentRegisterImpl::setDocumentTypeRepo(std::shared_ptr<const document
void
StorageComponentRegisterImpl::setLoadTypes(documentapi::LoadTypeSet::SP loadTypes)
{
- vespalib::LockGuard lock(_componentLock);
+ std::lock_guard lock(_componentLock);
_loadTypes = loadTypes;
for (auto& component : _components) {
component->setLoadTypes(loadTypes);
@@ -97,7 +97,7 @@ StorageComponentRegisterImpl::setLoadTypes(documentapi::LoadTypeSet::SP loadType
void
StorageComponentRegisterImpl::setPriorityConfig(const PriorityConfig& config)
{
- vespalib::LockGuard lock(_componentLock);
+ std::lock_guard lock(_componentLock);
_priorityConfig = config;
for (auto& component : _components) {
component->setPriorityConfig(config);
@@ -107,7 +107,7 @@ StorageComponentRegisterImpl::setPriorityConfig(const PriorityConfig& config)
void
StorageComponentRegisterImpl::setBucketIdFactory(const document::BucketIdFactory& factory)
{
- vespalib::LockGuard lock(_componentLock);
+ std::lock_guard lock(_componentLock);
_bucketIdFactory = factory;
for (auto& component : _components) {
component->setBucketIdFactory(factory);
@@ -117,7 +117,7 @@ StorageComponentRegisterImpl::setBucketIdFactory(const document::BucketIdFactory
void
StorageComponentRegisterImpl::setDistribution(lib::Distribution::SP distribution)
{
- vespalib::LockGuard lock(_componentLock);
+ std::lock_guard lock(_componentLock);
_distribution = distribution;
for (auto& component : _components) {
component->setDistribution(distribution);
@@ -127,7 +127,7 @@ StorageComponentRegisterImpl::setDistribution(lib::Distribution::SP distribution
void
StorageComponentRegisterImpl::setBucketSpacesConfig(const BucketspacesConfig& config)
{
- vespalib::LockGuard lock(_componentLock);
+ std::lock_guard lock(_componentLock);
_bucketSpacesConfig = config;
}
diff --git a/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h b/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h
index 956397d7cf4..b22ea93223b 100644
--- a/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h
+++ b/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h
@@ -24,7 +24,7 @@ class StorageComponentRegisterImpl
using PriorityConfig = StorageComponent::PriorityConfig;
using BucketspacesConfig = vespa::config::content::core::internal::InternalBucketspacesType;
- vespalib::Lock _componentLock;
+ std::mutex _componentLock;
std::vector<StorageComponent*> _components;
vespalib::string _clusterName;
const lib::NodeType* _nodeType;
diff --git a/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.cpp b/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.cpp
index 3db3ec5dfcd..60b2c625d43 100644
--- a/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.cpp
+++ b/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.cpp
@@ -73,7 +73,7 @@ void
ModifiedBucketChecker::configure(
std::unique_ptr<vespa::config::content::core::StorServerConfig> newConfig)
{
- vespalib::LockGuard lock(_stateLock);
+ std::lock_guard lock(_stateLock);
if (newConfig->bucketRecheckingChunkSize < 1) {
throw config::InvalidConfigException(
"Cannot have bucket rechecking chunk size of less than 1");
@@ -135,7 +135,7 @@ ModifiedBucketChecker::onInternalReply(
const std::shared_ptr<api::InternalReply>& r)
{
if (r->getType() == RecheckBucketInfoReply::ID) {
- vespalib::LockGuard guard(_stateLock);
+ std::lock_guard guard(_stateLock);
assert(_pendingRequests > 0);
--_pendingRequests;
if (_pendingRequests == 0 && moreChunksRemaining()) {
@@ -158,7 +158,7 @@ ModifiedBucketChecker::requestModifiedBucketsFromProvider(document::BucketSpace
return false;
}
{
- vespalib::LockGuard guard(_stateLock);
+ std::lock_guard guard(_stateLock);
_rechecksNotStarted.reset(bucketSpace, result.getList());
}
return true;
@@ -202,7 +202,7 @@ ModifiedBucketChecker::tick()
// we want getModifiedBuckets() to called outside the lock.
bool shouldRequestFromProvider = false;
{
- vespalib::LockGuard guard(_stateLock);
+ std::lock_guard guard(_stateLock);
if (!currentChunkFinished()) {
return true;
}
@@ -216,7 +216,7 @@ ModifiedBucketChecker::tick()
std::vector<RecheckBucketInfoCommand::SP> commandsToSend;
{
- vespalib::LockGuard guard(_stateLock);
+ std::lock_guard guard(_stateLock);
if (moreChunksRemaining()) {
nextRecheckChunk(commandsToSend);
}
diff --git a/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h b/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h
index 05389cec3da..7114d1f676f 100644
--- a/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h
+++ b/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h
@@ -86,7 +86,7 @@ private:
framework::Thread::UP _thread;
config::ConfigFetcher _configFetcher;
vespalib::Monitor _monitor;
- vespalib::Lock _stateLock;
+ std::mutex _stateLock;
CyclicBucketSpaceIterator::UP _bucketSpaces;
BucketIdListResult _rechecksNotStarted;
size_t _pendingRequests;
diff --git a/storage/src/vespa/storage/storageserver/bouncer.cpp b/storage/src/vespa/storage/storageserver/bouncer.cpp
index bc9708f70a2..8a0cffedd05 100644
--- a/storage/src/vespa/storage/storageserver/bouncer.cpp
+++ b/storage/src/vespa/storage/storageserver/bouncer.cpp
@@ -72,7 +72,7 @@ Bouncer::configure(std::unique_ptr<vespa::config::content::core::StorBouncerConf
{
log_config_received(*config);
validateConfig(*config);
- vespalib::LockGuard lock(_lock);
+ std::lock_guard lock(_lock);
_config = std::move(config);
}
@@ -248,7 +248,7 @@ Bouncer::onDown(const std::shared_ptr<api::StorageMessage>& msg)
bool abortLoadWhenClusterDown;
int feedPriorityLowerBound;
{
- vespalib::LockGuard lock(_lock);
+ std::lock_guard lock(_lock);
state = &getDerivedNodeState(msg->getBucket().getBucketSpace()).getState();
maxClockSkewInSeconds = _config->maxClockSkewSeconds;
abortLoadWhenClusterDown = _config->stopExternalLoadWhenClusterDown;
@@ -325,7 +325,7 @@ deriveNodeState(const lib::NodeState &reportedNodeState,
void
Bouncer::handleNewState()
{
- vespalib::LockGuard lock(_lock);
+ std::lock_guard lock(_lock);
const auto reportedNodeState = *_component.getStateUpdater().getReportedNodeState();
const auto clusterStateBundle = _component.getStateUpdater().getClusterStateBundle();
const auto &clusterState = *clusterStateBundle->getBaselineClusterState();
diff --git a/storage/src/vespa/storage/storageserver/bouncer.h b/storage/src/vespa/storage/storageserver/bouncer.h
index 19c8e084c7d..ee51114fcbe 100644
--- a/storage/src/vespa/storage/storageserver/bouncer.h
+++ b/storage/src/vespa/storage/storageserver/bouncer.h
@@ -17,7 +17,6 @@
#include <vespa/storage/common/storagecomponent.h>
#include <vespa/storage/common/storagelink.h>
#include <vespa/storage/config/config-stor-bouncer.h>
-#include <vespa/vespalib/util/sync.h>
#include <unordered_map>
namespace config { class ConfigUri; }
@@ -32,8 +31,8 @@ class Bouncer : public StorageLink,
{
std::unique_ptr<vespa::config::content::core::StorBouncerConfig> _config;
StorageComponent _component;
- vespalib::Lock _lock;
- lib::NodeState _baselineNodeState;
+ std::mutex _lock;
+ lib::NodeState _baselineNodeState;
using BucketSpaceNodeStateMapping = std::unordered_map<document::BucketSpace, lib::NodeState, document::BucketSpace::hash>;
BucketSpaceNodeStateMapping _derivedNodeStates;
const lib::State* _clusterState;
diff --git a/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.cpp b/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.cpp
index 66e0209d4b7..aec0adf790c 100644
--- a/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.cpp
+++ b/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.cpp
@@ -57,7 +57,7 @@ ChangedBucketOwnershipHandler::configure(
void
ChangedBucketOwnershipHandler::reloadClusterState()
{
- vespalib::LockGuard guard(_stateLock);
+ std::lock_guard guard(_stateLock);
const auto clusterStateBundle = _component.getStateUpdater().getClusterStateBundle();
setCurrentOwnershipWithStateNoLock(*clusterStateBundle);
}
@@ -258,7 +258,7 @@ ChangedBucketOwnershipHandler::onSetSystemState(
// can get through in the off-case that the lower level storage links
// don't apply the state immediately for some reason.
{
- vespalib::LockGuard guard(_stateLock);
+ std::lock_guard guard(_stateLock);
oldOwnership = _currentOwnership;
setCurrentOwnershipWithStateNoLock(stateCmd->getClusterStateBundle());
newOwnership = _currentOwnership;
@@ -301,7 +301,7 @@ ChangedBucketOwnershipHandler::onSetSystemState(
void
ChangedBucketOwnershipHandler::storageDistributionChanged()
{
- vespalib::LockGuard guard(_stateLock);
+ std::lock_guard guard(_stateLock);
_currentOwnership = std::make_shared<OwnershipState>(
_component.getBucketSpaceRepo(), _currentState);
}
@@ -345,7 +345,7 @@ ChangedBucketOwnershipHandler::isMutatingExternalOperation(
ChangedBucketOwnershipHandler::OwnershipState::CSP
ChangedBucketOwnershipHandler::getCurrentOwnershipState() const
{
- vespalib::LockGuard guard(_stateLock);
+ std::lock_guard guard(_stateLock);
return _currentOwnership;
}
diff --git a/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.h b/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.h
index 1e524b6b2fc..0fc456b515c 100644
--- a/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.h
+++ b/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.h
@@ -4,7 +4,6 @@
#include <vespa/document/bucket/bucketid.h>
#include <vespa/storage/common/storagelink.h>
#include <vespa/vdslib/distribution/distribution.h>
-#include <vespa/vespalib/util/sync.h>
#include <vespa/metrics/metrics.h>
#include <vespa/config/config.h>
#include <vespa/config-persistence.h>
@@ -110,9 +109,9 @@ public:
private:
ServiceLayerComponent _component;
- Metrics _metrics;
+ Metrics _metrics;
config::ConfigFetcher _configFetcher;
- vespalib::Lock _stateLock;
+ mutable std::mutex _stateLock;
std::shared_ptr<const lib::ClusterStateBundle> _currentState;
OwnershipState::CSP _currentOwnership;
diff --git a/storage/src/vespa/storage/storageserver/communicationmanager.cpp b/storage/src/vespa/storage/storageserver/communicationmanager.cpp
index cfd74bacf16..8a7cc8ffc61 100644
--- a/storage/src/vespa/storage/storageserver/communicationmanager.cpp
+++ b/storage/src/vespa/storage/storageserver/communicationmanager.cpp
@@ -187,7 +187,7 @@ CommunicationManager::handleReply(std::unique_ptr<mbus::Reply> reply)
if (protocolName == documentapi::DocumentProtocol::NAME) {
std::shared_ptr<api::StorageCommand> originalCommand;
{
- vespalib::LockGuard lock(_messageBusSentLock);
+ std::lock_guard lock(_messageBusSentLock);
typedef std::map<api::StorageMessage::Id, api::StorageCommand::SP> MessageMap;
MessageMap::iterator iter(_messageBusSent.find(reply->getContext().value.UINT64));
if (iter != _messageBusSent.end()) {
@@ -601,7 +601,7 @@ CommunicationManager::sendCommand(
mbusMsg->setRetryEnabled(false);
{
- vespalib::LockGuard lock(_messageBusSentLock);
+ std::lock_guard lock(_messageBusSentLock);
_messageBusSent[msg->getMsgId()] = msg;
}
sendMessageBusMessage(msg, std::move(mbusMsg), address.getRoute());
diff --git a/storage/src/vespa/storage/storageserver/communicationmanager.h b/storage/src/vespa/storage/storageserver/communicationmanager.h
index ce7906385d0..b10b12f404e 100644
--- a/storage/src/vespa/storage/storageserver/communicationmanager.h
+++ b/storage/src/vespa/storage/storageserver/communicationmanager.h
@@ -112,7 +112,7 @@ private:
std::unique_ptr<mbus::DestinationSession> _messageBusSession;
std::unique_ptr<mbus::SourceSession> _sourceSession;
- vespalib::Lock _messageBusSentLock;
+ std::mutex _messageBusSentLock;
std::map<api::StorageMessage::Id, std::shared_ptr<api::StorageCommand> > _messageBusSent;
config::ConfigUri _configUri;
diff --git a/storage/src/vespa/storage/storageserver/opslogger.cpp b/storage/src/vespa/storage/storageserver/opslogger.cpp
index b6bceabf7a1..3e1fc34d470 100644
--- a/storage/src/vespa/storage/storageserver/opslogger.cpp
+++ b/storage/src/vespa/storage/storageserver/opslogger.cpp
@@ -42,7 +42,7 @@ OpsLogger::onClose()
void
OpsLogger::configure(std::unique_ptr<vespa::config::content::core::StorOpsloggerConfig> config)
{
- vespalib::LockGuard lock(_lock);
+ std::lock_guard lock(_lock);
// If no change in state, ignore
if (config->targetfile == _fileName) return;
// If a change we need to close old handle if open
@@ -79,7 +79,7 @@ OpsLogger::onPutReply(const std::shared_ptr<api::PutReply>& msg)
<< "\tPUT\t" << msg->getDocumentId() << "\t"
<< msg->getResult() << "\n";
{
- vespalib::LockGuard lock(_lock);
+ std::lock_guard lock(_lock);
if (_targetFile == nullptr) return false;
fwrite(ost.str().c_str(), ost.str().length(), 1, _targetFile);
fflush(_targetFile);
@@ -96,7 +96,7 @@ OpsLogger::onUpdateReply(const std::shared_ptr<api::UpdateReply>& msg)
<< "\tUPDATE\t" << msg->getDocumentId() << "\t"
<< msg->getResult() << "\n";
{
- vespalib::LockGuard lock(_lock);
+ std::lock_guard lock(_lock);
if (_targetFile == nullptr) return false;
fwrite(ost.str().c_str(), ost.str().length(), 1, _targetFile);
fflush(_targetFile);
@@ -113,7 +113,7 @@ OpsLogger::onRemoveReply(const std::shared_ptr<api::RemoveReply>& msg)
<< "\tREMOVE\t" << msg->getDocumentId() << "\t"
<< msg->getResult() << "\n";
{
- vespalib::LockGuard lock(_lock);
+ std::lock_guard lock(_lock);
if (_targetFile == nullptr) return false;
fwrite(ost.str().c_str(), ost.str().length(), 1, _targetFile);
fflush(_targetFile);
@@ -130,7 +130,7 @@ OpsLogger::onGetReply(const std::shared_ptr<api::GetReply>& msg)
<< "\tGET\t" << msg->getDocumentId() << "\t"
<< msg->getResult() << "\n";
{
- vespalib::LockGuard lock(_lock);
+ std::lock_guard lock(_lock);
if (_targetFile == nullptr) return false;
fwrite(ost.str().c_str(), ost.str().length(), 1, _targetFile);
fflush(_targetFile);
diff --git a/storage/src/vespa/storage/storageserver/opslogger.h b/storage/src/vespa/storage/storageserver/opslogger.h
index 1e903bb1ef3..cecadf9ed1d 100644
--- a/storage/src/vespa/storage/storageserver/opslogger.h
+++ b/storage/src/vespa/storage/storageserver/opslogger.h
@@ -13,7 +13,6 @@
#include <vespa/storageapi/messageapi/storagemessage.h>
#include <vespa/storageapi/message/state.h>
#include <vespa/storage/config/config-stor-opslogger.h>
-#include <vespa/vespalib/util/sync.h>
#include <vespa/config/config.h>
namespace storage {
@@ -23,7 +22,7 @@ class OpsLogger : public StorageLink,
public:
explicit OpsLogger(StorageComponentRegister&,
const config::ConfigUri & configUri);
- ~OpsLogger();
+ ~OpsLogger() override;
void onClose() override;
void print(std::ostream& out, bool verbose, const std::string& indent) const override;
@@ -36,9 +35,9 @@ public:
bool onDown(const std::shared_ptr<api::StorageMessage>&) override { return false; };
void configure(std::unique_ptr<vespa::config::content::core::StorOpsloggerConfig> config) override;
private:
- vespalib::Lock _lock;
- std::string _fileName;
- FILE* _targetFile;
+ std::mutex _lock;
+ std::string _fileName;
+ FILE * _targetFile;
framework::Component _component;
config::ConfigFetcher _configFetcher;
diff --git a/storage/src/vespa/storage/storageserver/priorityconverter.cpp b/storage/src/vespa/storage/storageserver/priorityconverter.cpp
index 8d0f18b4157..41bea1b44df 100644
--- a/storage/src/vespa/storage/storageserver/priorityconverter.cpp
+++ b/storage/src/vespa/storage/storageserver/priorityconverter.cpp
@@ -31,7 +31,7 @@ PriorityConverter::toStoragePriority(documentapi::Priority::Value documentApiPri
documentapi::Priority::Value
PriorityConverter::toDocumentPriority(uint8_t storagePriority) const
{
- vespalib::LockGuard guard(_mutex);
+ std::lock_guard guard(_mutex);
std::map<uint8_t, documentapi::Priority::Value>::const_iterator iter =
_reverseMapping.lower_bound(storagePriority);
@@ -63,7 +63,7 @@ PriorityConverter::configure(std::unique_ptr<vespa::config::content::core::StorP
_mapping[documentapi::Priority::PRI_VERY_LOW] = config->veryLow;
_mapping[documentapi::Priority::PRI_LOWEST] = config->lowest;
- vespalib::LockGuard guard(_mutex);
+ std::lock_guard guard(_mutex);
_reverseMapping.clear();
_reverseMapping[config->highest] = documentapi::Priority::PRI_HIGHEST;
_reverseMapping[config->veryHigh] = documentapi::Priority::PRI_VERY_HIGH;
diff --git a/storage/src/vespa/storage/storageserver/priorityconverter.h b/storage/src/vespa/storage/storageserver/priorityconverter.h
index f4cfb7488e2..3a4950fdb31 100644
--- a/storage/src/vespa/storage/storageserver/priorityconverter.h
+++ b/storage/src/vespa/storage/storageserver/priorityconverter.h
@@ -20,8 +20,8 @@ class PriorityConverter
public:
typedef vespa::config::content::core::StorPrioritymappingConfig Config;
- PriorityConverter(const config::ConfigUri& configUri);
- ~PriorityConverter();
+ explicit PriorityConverter(const config::ConfigUri& configUri);
+ ~PriorityConverter() override;
/** Converts the given priority into a storage api priority number. */
uint8_t toStoragePriority(documentapi::Priority::Value) const;
@@ -40,7 +40,7 @@ private:
std::array<std::atomic<uint8_t>, PRI_ENUM_SIZE> _mapping;
std::map<uint8_t, documentapi::Priority::Value> _reverseMapping;
- vespalib::Lock _mutex;
+ mutable std::mutex _mutex;
config::ConfigFetcher _configFetcher;
};
diff --git a/storage/src/vespa/storage/storageserver/rpc/shared_rpc_resources.cpp b/storage/src/vespa/storage/storageserver/rpc/shared_rpc_resources.cpp
index 8896df7a155..553132507ab 100644
--- a/storage/src/vespa/storage/storageserver/rpc/shared_rpc_resources.cpp
+++ b/storage/src/vespa/storage/storageserver/rpc/shared_rpc_resources.cpp
@@ -66,8 +66,8 @@ SharedRpcResources::SharedRpcResources(const config::ConfigUri& config_uri,
: _thread_pool(std::make_unique<FastOS_ThreadPool>(1024*60)),
_transport(std::make_unique<FNET_Transport>(rpc_thread_pool_size)),
_orb(std::make_unique<FRT_Supervisor>(_transport.get())),
- _slobrok_register(std::make_unique<slobrok::api::RegisterAPI>(*_orb, config_uri)),
- _slobrok_mirror(std::make_unique<slobrok::api::MirrorAPI>(*_orb, config_uri)),
+ _slobrok_register(std::make_unique<slobrok::api::RegisterAPI>(*_orb, slobrok::ConfiguratorFactory(config_uri))),
+ _slobrok_mirror(std::make_unique<slobrok::api::MirrorAPI>(*_orb, slobrok::ConfiguratorFactory(config_uri))),
_target_factory(std::make_unique<RpcTargetFactoryImpl>(*_orb)),
_hostname(vespalib::HostName::get()),
_rpc_server_port(rpc_server_port),
diff --git a/storage/src/vespa/storage/storageserver/servicelayernode.cpp b/storage/src/vespa/storage/storageserver/servicelayernode.cpp
index 4f1db0e1b30..1edfcde393b 100644
--- a/storage/src/vespa/storage/storageserver/servicelayernode.cpp
+++ b/storage/src/vespa/storage/storageserver/servicelayernode.cpp
@@ -91,7 +91,7 @@ ServiceLayerNode::subscribeToConfigs()
StorageNode::subscribeToConfigs();
_configFetcher.reset(new config::ConfigFetcher(_configUri.getContext()));
- vespalib::LockGuard configLockGuard(_configLock);
+ std::lock_guard configLockGuard(_configLock);
// Verify and set disk count
if (_serverConfig->diskCount != 0
&& _serverConfig->diskCount != _partitions.size())
diff --git a/storage/src/vespa/storage/storageserver/statemanager.cpp b/storage/src/vespa/storage/storageserver/statemanager.cpp
index f9b5e284b93..db4dfd0323e 100644
--- a/storage/src/vespa/storage/storageserver/statemanager.cpp
+++ b/storage/src/vespa/storage/storageserver/statemanager.cpp
@@ -204,14 +204,14 @@ StateManager::getClusterStateBundle() const
void
StateManager::addStateListener(StateListener& listener)
{
- vespalib::LockGuard lock(_listenerLock);
+ std::lock_guard lock(_listenerLock);
_stateListeners.push_back(&listener);
}
void
StateManager::removeStateListener(StateListener& listener)
{
- vespalib::LockGuard lock(_listenerLock);
+ std::lock_guard lock(_listenerLock);
for (auto it = _stateListeners.begin(); it != _stateListeners.end();) {
if (*it == &listener) {
it = _stateListeners.erase(it);
@@ -282,7 +282,7 @@ StateManager::notifyStateListeners()
if (_notifyingListeners) {
return;
}
- vespalib::LockGuard listenerLock(_listenerLock);
+ std::lock_guard listenerLock(_listenerLock);
_notifyingListeners = true;
lib::NodeState::SP newState;
while (true) {
diff --git a/storage/src/vespa/storage/storageserver/statemanager.h b/storage/src/vespa/storage/storageserver/statemanager.h
index 3d231c070ef..b6f43eb270e 100644
--- a/storage/src/vespa/storage/storageserver/statemanager.h
+++ b/storage/src/vespa/storage/storageserver/statemanager.h
@@ -45,7 +45,7 @@ class StateManager : public NodeStateUpdater,
StorageComponent _component;
metrics::MetricManager& _metricManager;
vespalib::Monitor _stateLock;
- vespalib::Lock _listenerLock;
+ std::mutex _listenerLock;
std::shared_ptr<lib::NodeState> _nodeState;
std::shared_ptr<lib::NodeState> _nextNodeState;
using ClusterStateBundle = lib::ClusterStateBundle;
diff --git a/storage/src/vespa/storage/storageserver/storagenode.cpp b/storage/src/vespa/storage/storageserver/storagenode.cpp
index aa50391c037..c1cfc97bab6 100644
--- a/storage/src/vespa/storage/storageserver/storagenode.cpp
+++ b/storage/src/vespa/storage/storageserver/storagenode.cpp
@@ -129,7 +129,7 @@ StorageNode::subscribeToConfigs()
_configFetcher->start();
- vespalib::LockGuard configLockGuard(_configLock);
+ std::lock_guard configLockGuard(_configLock);
_serverConfig = std::move(_newServerConfig);
_clusterConfig = std::move(_newClusterConfig);
_distributionConfig = std::move(_newDistributionConfig);
@@ -252,7 +252,7 @@ StorageNode::initializeStatusWebServer()
void
StorageNode::setNewDocumentRepo(const std::shared_ptr<const document::DocumentTypeRepo>& repo)
{
- vespalib::LockGuard configLockGuard(_configLock);
+ std::lock_guard configLockGuard(_configLock);
_context.getComponentRegister().setDocumentTypeRepo(repo);
if (_communicationManager != nullptr) {
_communicationManager->updateMessagebusProtocol(repo);
@@ -280,7 +280,7 @@ StorageNode::handleLiveConfigUpdate(const InitialGuard & initGuard)
{
// Make sure we don't conflict with initialize or shutdown threads.
(void) initGuard;
- vespalib::LockGuard configLockGuard(_configLock);
+ std::lock_guard configLockGuard(_configLock);
assert(_chain);
// If we get here, initialize is done running. We have to handle changes
@@ -476,7 +476,7 @@ void StorageNode::configure(std::unique_ptr<StorServerConfig> config) {
// to a variable where we can find it later when processing config
// updates
{
- vespalib::LockGuard configLockGuard(_configLock);
+ std::lock_guard configLockGuard(_configLock);
_newServerConfig = std::move(config);
}
if (_serverConfig) {
@@ -488,7 +488,7 @@ void StorageNode::configure(std::unique_ptr<StorServerConfig> config) {
void StorageNode::configure(std::unique_ptr<UpgradingConfig> config) {
log_config_received(*config);
{
- vespalib::LockGuard configLockGuard(_configLock);
+ std::lock_guard configLockGuard(_configLock);
_newClusterConfig = std::move(config);
}
if (_clusterConfig) {
@@ -500,7 +500,7 @@ void StorageNode::configure(std::unique_ptr<UpgradingConfig> config) {
void StorageNode::configure(std::unique_ptr<StorDistributionConfig> config) {
log_config_received(*config);
{
- vespalib::LockGuard configLockGuard(_configLock);
+ std::lock_guard configLockGuard(_configLock);
_newDistributionConfig = std::move(config);
}
if (_distributionConfig) {
@@ -512,7 +512,7 @@ void StorageNode::configure(std::unique_ptr<StorDistributionConfig> config) {
void StorageNode::configure(std::unique_ptr<StorPrioritymappingConfig> config) {
log_config_received(*config);
{
- vespalib::LockGuard configLockGuard(_configLock);
+ std::lock_guard configLockGuard(_configLock);
_newPriorityConfig = std::move(config);
}
if (_priorityConfig) {
@@ -530,7 +530,7 @@ StorageNode::configure(std::unique_ptr<document::DocumenttypesConfig> config,
if (!hasChanged)
return;
{
- vespalib::LockGuard configLockGuard(_configLock);
+ std::lock_guard configLockGuard(_configLock);
_newDoctypesConfig = std::move(config);
}
if (_doctypesConfig) {
@@ -542,7 +542,7 @@ StorageNode::configure(std::unique_ptr<document::DocumenttypesConfig> config,
void StorageNode::configure(std::unique_ptr<BucketspacesConfig> config) {
log_config_received(*config);
{
- vespalib::LockGuard configLockGuard(_configLock);
+ std::lock_guard configLockGuard(_configLock);
_newBucketSpacesConfig = std::move(config);
}
if (_bucketSpacesConfig) {
diff --git a/storage/src/vespa/storage/storageserver/storagenode.h b/storage/src/vespa/storage/storageserver/storagenode.h
index 91a2bae3190..adc55266588 100644
--- a/storage/src/vespa/storage/storageserver/storagenode.h
+++ b/storage/src/vespa/storage/storageserver/storagenode.h
@@ -144,7 +144,7 @@ private:
protected:
// Lock taken while doing configuration of the server.
- vespalib::Lock _configLock;
+ std::mutex _configLock;
std::mutex _initial_config_mutex;
using InitialGuard = std::lock_guard<std::mutex>;
// Current running config. Kept, such that we can see what has been
diff --git a/storage/src/vespa/storage/visiting/recoveryvisitor.cpp b/storage/src/vespa/storage/visiting/recoveryvisitor.cpp
index 80e74e890a1..1ac0248961a 100644
--- a/storage/src/vespa/storage/visiting/recoveryvisitor.cpp
+++ b/storage/src/vespa/storage/visiting/recoveryvisitor.cpp
@@ -34,7 +34,7 @@ RecoveryVisitor::handleDocuments(const document::BucketId& bid,
std::vector<spi::DocEntry::UP>& entries,
HitCounter& hitCounter)
{
- vespalib::LockGuard guard(_mutex);
+ std::lock_guard guard(_mutex);
LOG(debug, "Visitor %s handling block of %zu documents.", _id.c_str(), entries.size());
@@ -87,7 +87,7 @@ void RecoveryVisitor::completedBucket(const document::BucketId& bid, HitCounter&
LOG(debug, "Finished bucket %s", bid.toString().c_str());
{
- vespalib::LockGuard guard(_mutex);
+ std::lock_guard guard(_mutex);
CommandMap::iterator iter = _activeCommands.find(bid);
diff --git a/storage/src/vespa/storage/visiting/recoveryvisitor.h b/storage/src/vespa/storage/visiting/recoveryvisitor.h
index 1da2acfed9c..fd296c30361 100644
--- a/storage/src/vespa/storage/visiting/recoveryvisitor.h
+++ b/storage/src/vespa/storage/visiting/recoveryvisitor.h
@@ -33,7 +33,7 @@ private:
using CommandMap = std::map<document::BucketId, CommandPtr>;
CommandMap _activeCommands;
- vespalib::Lock _mutex;
+ std::mutex _mutex;
};
struct RecoveryVisitorFactory : public VisitorFactory {
diff --git a/storage/src/vespa/storage/visiting/visitormanager.cpp b/storage/src/vespa/storage/visiting/visitormanager.cpp
index c1cd52cf5e5..7a450508375 100644
--- a/storage/src/vespa/storage/visiting/visitormanager.cpp
+++ b/storage/src/vespa/storage/visiting/visitormanager.cpp
@@ -661,7 +661,7 @@ VisitorManager::reportHtmlStatus(std::ostream& out,
}
// Only one can access status at a time as _statusRequest only holds
// answers from one request at a time
- vespalib::LockGuard sync(_statusLock);
+ std::lock_guard sync(_statusLock);
vespalib::MonitorGuard waiter(_statusMonitor);
// Send all subrequests
uint32_t parts = _visitorThread.size();
diff --git a/storage/src/vespa/storage/visiting/visitormanager.h b/storage/src/vespa/storage/visiting/visitormanager.h
index 3675a824e1d..70ba95396fc 100644
--- a/storage/src/vespa/storage/visiting/visitormanager.h
+++ b/storage/src/vespa/storage/visiting/visitormanager.h
@@ -75,10 +75,9 @@ private:
framework::MicroSecTime> > _recentlyDeletedVisitors;
framework::MicroSecTime _recentlyDeletedMaxTime;
- mutable vespalib::Lock _statusLock; // Only one can get status at a time
+ mutable std::mutex _statusLock; // Only one can get status at a time
mutable vespalib::Monitor _statusMonitor; // Notify when done
- mutable std::vector<std::shared_ptr<RequestStatusPageReply> >
- _statusRequest;
+ mutable std::vector<std::shared_ptr<RequestStatusPageReply> > _statusRequest;
bool _enforceQueueUse;
VisitorFactory::Map _visitorFactories;
diff --git a/vespaclient/src/vespa/vespaclient/vdsstates/statesapp.cpp b/vespaclient/src/vespa/vespaclient/vdsstates/statesapp.cpp
index 082aa83c3da..9393562bf28 100644
--- a/vespaclient/src/vespa/vespaclient/vdsstates/statesapp.cpp
+++ b/vespaclient/src/vespa/vespaclient/vdsstates/statesapp.cpp
@@ -254,11 +254,11 @@ struct StateApp : public FastOS_Application {
std::unique_ptr<slobrok::api::MirrorAPI> slobrok;
if (_options._slobrokConnectionSpec == "") {
config::ConfigUri config(_options._slobrokConfigId);
- slobrok.reset(new slobrok::api::MirrorAPI(supervisor.supervisor(), config));
+ slobrok = std::make_unique<slobrok::api::MirrorAPI>(supervisor.supervisor(), slobrok::ConfiguratorFactory(config));
} else {
std::vector<std::string> specList;
specList.push_back(_options._slobrokConnectionSpec);
- slobrok.reset(new slobrok::api::MirrorAPI(supervisor.supervisor(), specList));
+ slobrok = std::make_unique<slobrok::api::MirrorAPI>(supervisor.supervisor(), slobrok::ConfiguratorFactory(specList));
}
LOG(debug, "Waiting for slobrok data to be available.");
uint64_t startTime = getTimeInMillis();