aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@yahoo-inc.com>2017-03-03 12:34:23 +0000
committerTor Egge <Tor.Egge@yahoo-inc.com>2017-03-03 12:34:23 +0000
commit0116dc123ee4705e300125018d264375d34a54be (patch)
tree3ad63fbbb22e3cf29e8d82e1a0cb37b45fc4392d /searchcore/src
parente65a6d177986e9a866f0ae2806c1211ac0b439c6 (diff)
Use std::mutex instead of vespalib::Lock for proton config locks.
Diffstat (limited to 'searchcore/src')
-rw-r--r--searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.h6
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdb.cpp22
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdb.h4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.h3
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h3
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/proton.cpp15
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/proton.h4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/protonconfigurer.cpp14
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/protonconfigurer.h3
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h9
17 files changed, 60 insertions, 53 deletions
diff --git a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
index 0f77b5c5894..93a1b6de3ad 100644
--- a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
@@ -134,7 +134,7 @@ struct MyStoreOnlyContext
MyGetSerialNum _getSerialNum;
MyFileHeaderContext _fileHeader;
LegacyDocumentDBMetrics _metrics;
- vespalib::Lock _configLock;
+ std::mutex _configMutex;
HwInfo _hwInfo;
StoreOnlyContext _ctx;
MyStoreOnlyContext(IThreadingService &writeService,
@@ -147,7 +147,7 @@ struct MyStoreOnlyContext
_getSerialNum(),
_fileHeader(),
_metrics(DOCTYPE_NAME, 1),
- _configLock(),
+ _configMutex(),
_hwInfo(),
_ctx(_owner,
_syncProxy,
@@ -158,7 +158,7 @@ struct MyStoreOnlyContext
bucketDB,
bucketDBHandlerInitializer,
_metrics,
- _configLock,
+ _configMutex,
_hwInfo)
{
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp
index a75144b6a2a..5f6d818fd5d 100644
--- a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp
@@ -20,7 +20,7 @@ namespace proton
BootstrapConfigManager::BootstrapConfigManager(const vespalib::string & configId)
: _pendingConfigSnapshot(),
_configId(configId),
- _pendingConfigLock()
+ _pendingConfigMutex()
{ }
BootstrapConfigManager::~BootstrapConfigManager() { }
@@ -99,7 +99,7 @@ BootstrapConfigManager::update(const ConfigSnapshot & snapshot)
assert(newSnapshot->valid());
{
- vespalib::LockGuard lock(_pendingConfigLock);
+ std::lock_guard<std::mutex> lock(_pendingConfigMutex);
_pendingConfigSnapshot = newSnapshot;
}
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.h b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.h
index 32ecc9a7303..c3099663360 100644
--- a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.h
+++ b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.h
@@ -3,7 +3,7 @@
#pragma once
#include <vespa/config/retriever/configkeyset.h>
-#include <vespa/vespalib/util/sync.h>
+#include <mutex>
namespace config { class ConfigSnapshot; };
namespace proton {
@@ -23,7 +23,7 @@ public:
std::shared_ptr<BootstrapConfig>
getConfig() const
{
- vespalib::LockGuard lock(_pendingConfigLock);
+ std::lock_guard<std::mutex> lock(_pendingConfigMutex);
return _pendingConfigSnapshot;
}
void update(const config::ConfigSnapshot & snapshot);
@@ -31,7 +31,7 @@ public:
private:
std::shared_ptr<BootstrapConfig> _pendingConfigSnapshot;
vespalib::string _configId;
- vespalib::Lock _pendingConfigLock;
+ mutable std::mutex _pendingConfigMutex;
};
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
index 6bc74a3311f..8527211d3bb 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
@@ -114,7 +114,7 @@ DocumentDB::DocumentDB(const vespalib::string &baseDir,
_initConfigSnapshot(),
_initConfigSerialNum(0u),
_pendingConfigSnapshot(configSnapshot),
- _configLock(),
+ _configMutex(),
_activeConfigSnapshot(),
_activeConfigSnapshotGeneration(0),
_activeConfigSnapshotSerialNum(0u),
@@ -157,7 +157,7 @@ DocumentDB::DocumentDB(const vespalib::string &baseDir,
getMetricsCollection(),
queryLimiter,
clock,
- _configLock,
+ _configMutex,
_baseDir,
protonCfg,
hwInfo),
@@ -226,7 +226,7 @@ void DocumentDB::registerReferent()
void DocumentDB::setActiveConfig(const DocumentDBConfig::SP &config,
SerialNum serialNum, int64_t generation) {
- vespalib::LockGuard guard(_configLock);
+ lock_guard guard(_configMutex);
registerReferent();
_activeConfigSnapshot = config;
assert(generation >= config->getGeneration());
@@ -237,7 +237,7 @@ void DocumentDB::setActiveConfig(const DocumentDBConfig::SP &config,
}
DocumentDBConfig::SP DocumentDB::getActiveConfig() const {
- vespalib::LockGuard guard(_configLock);
+ lock_guard guard(_configMutex);
return _activeConfigSnapshot;
}
@@ -294,7 +294,7 @@ DocumentDB::newConfigSnapshot(DocumentDBConfig::SP snapshot)
// Called by executor thread
_pendingConfigSnapshot.set(snapshot);
{
- vespalib::LockGuard guard(_configLock);
+ lock_guard guard(_configMutex);
if (_activeConfigSnapshot.get() == NULL) {
LOG(debug,
"DocumentDB(%s): Ignoring new available config snapshot. "
@@ -428,7 +428,7 @@ DocumentDB::applyConfig(DocumentDBConfig::SP configSnapshot,
bool fallbackConfig = false;
int64_t generation = configSnapshot->getGeneration();
{
- vespalib::LockGuard guard(_configLock);
+ lock_guard guard(_configMutex);
assert(_activeConfigSnapshot.get());
if (_activeConfigSnapshot.get() == configSnapshot.get() ||
*_activeConfigSnapshot == *configSnapshot) {
@@ -596,7 +596,7 @@ void
DocumentDB::close()
{
{
- vespalib::LockGuard guard(_configLock);
+ lock_guard guard(_configMutex);
_state.enterShutdownState();
}
_writeService.master().sync(); // Complete all tasks that didn't observe shutdown
@@ -665,7 +665,7 @@ DocumentDB::saveInitialConfig(const DocumentDBConfig &configSnapshot)
{
// Only called from ctor
- vespalib::LockGuard guard(_configLock);
+ lock_guard guard(_configMutex);
if (_config_store->getBestSerialNum() != 0)
return; // Initial config already present
@@ -891,7 +891,7 @@ DocumentDB::enterApplyLiveConfigState()
assert(_writeService.master().isCurrentThread());
// Enable reconfig and queue currently pending config as executor task.
{
- vespalib::LockGuard guard(_configLock);
+ lock_guard guard(_configMutex);
(void) _state.enterApplyLiveConfigState();
}
_writeService.master().execute(makeTask(makeClosure(this,
@@ -1072,7 +1072,7 @@ DocumentDB::listSchema(std::vector<vespalib::string> &fieldNames,
int64_t DocumentDB::getActiveGeneration() const {
- vespalib::LockGuard guard(_configLock);
+ lock_guard guard(_configMutex);
return _activeConfigSnapshotGeneration;
}
@@ -1140,7 +1140,7 @@ DocumentDB::performStartMaintenance(void)
DocumentDBMaintenanceConfig::SP maintenanceConfig;
{
- vespalib::LockGuard guard(_configLock);
+ lock_guard guard(_configMutex);
if (_state.getClosed())
return;
assert(_activeConfigSnapshot.get() != NULL);
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h
index f343812c690..1f6ad274a0e 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h
@@ -39,6 +39,7 @@
#include <vespa/searchcore/proton/attribute/attribute_usage_filter.h>
#include "disk_mem_usage_forwarder.h"
#include <vespa/metrics/updatehook.h>
+#include <mutex>
using vespa::config::search::core::ProtonConfig;
@@ -103,11 +104,12 @@ private:
typedef fastos::TimeStamp TimeStamp;
typedef vespalib::Closure Closure;
typedef search::index::Schema Schema;
+ using lock_guard = std::lock_guard<std::mutex>;
// variables related to reconfig
DocumentDBConfig::SP _initConfigSnapshot;
SerialNum _initConfigSerialNum;
vespalib::VarHolder<DocumentDBConfig::SP> _pendingConfigSnapshot;
- vespalib::Lock _configLock; // protects _active* below.
+ mutable std::mutex _configMutex; // protects _active* below.
DocumentDBConfig::SP _activeConfigSnapshot;
int64_t _activeConfigSnapshotGeneration;
SerialNum _activeConfigSnapshotSerialNum;
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp
index b749d7abd3b..1a67da18e7a 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp
@@ -279,7 +279,7 @@ DocumentDBConfigManager::update(const ConfigSnapshot &snapshot)
extraConfigs));
assert(newSnapshot->valid());
{
- vespalib::LockGuard lock(_pendingConfigLock);
+ std::lock_guard<std::mutex> lock(_pendingConfigMutex);
_pendingConfigSnapshot = newSnapshot;
}
}
@@ -293,7 +293,7 @@ DocumentDBConfigManager(const vespalib::string &configId,
_bootstrapConfig(),
_pendingConfigSnapshot(),
_ignoreForwardedConfig(true),
- _pendingConfigLock(),
+ _pendingConfigMutex(),
_extraConfigKeys()
{ }
@@ -301,7 +301,7 @@ DocumentDBConfigManager::~DocumentDBConfigManager() { }
DocumentDBConfig::SP
DocumentDBConfigManager::getConfig() const {
- vespalib::LockGuard lock(_pendingConfigLock);
+ std::lock_guard<std::mutex> lock(_pendingConfigMutex);
return _pendingConfigSnapshot;
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.h b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.h
index 3b8fad375bc..d903316f361 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.h
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.h
@@ -5,6 +5,7 @@
#include <vespa/vespalib/stllike/string.h>
#include <vespa/config/config.h>
#include "documentdbconfig.h"
+#include <mutex>
namespace proton {
@@ -24,7 +25,7 @@ private:
BootstrapConfigSP _bootstrapConfig;
DocumentDBConfig::SP _pendingConfigSnapshot;
bool _ignoreForwardedConfig;
- vespalib::Lock _pendingConfigLock;
+ mutable std::mutex _pendingConfigMutex;
config::ConfigKeySet _extraConfigKeys;
search::index::Schema::SP
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp
index bfbb15fba90..293c024081e 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp
@@ -29,7 +29,7 @@ DocumentSubDBCollection::DocumentSubDBCollection(
DocumentDBMetricsCollection &metrics,
matching::QueryLimiter &queryLimiter,
const vespalib::Clock &clock,
- vespalib::Lock &configLock,
+ std::mutex &configMutex,
const vespalib::string &baseDir,
const ProtonConfig &protonCfg,
const HwInfo &hwInfo)
@@ -62,7 +62,7 @@ DocumentSubDBCollection::DocumentSubDBCollection(
_bucketDB,
*_bucketDBHandler,
metrics.getLegacyMetrics(),
- configLock,
+ configMutex,
hwInfo);
_subDBs.push_back
(new SearchableDocSubDB
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h
index 45be1041ef3..b63d78eb378 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h
+++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h
@@ -15,6 +15,7 @@
#include <vespa/searchcore/proton/reprocessing/reprocessingrunner.h>
#include <vespa/searchcore/proton/bucketdb/bucketdbhandler.h>
#include <vespa/searchcore/proton/initializer/initializer_task.h>
+#include <mutex>
namespace proton {
class DocumentDBConfig;
@@ -58,7 +59,7 @@ public:
DocumentDBMetricsCollection &metrics,
matching::QueryLimiter & queryLimiter,
const vespalib::Clock &clock,
- vespalib::Lock &configLock,
+ std::mutex &configMutex,
const vespalib::string &baseDir,
const vespa::config::search::core::ProtonConfig &protonCfg,
const HwInfo &hwInfo);
diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp
index 1a62b1ae00a..209e9baf280 100644
--- a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp
@@ -239,7 +239,7 @@ FastAccessDocSubDB::initViews(const DocumentDBConfig &configSnapshot,
_iSearchView.set(ISearchHandler::SP(new EmptySearchView));
IAttributeWriter::SP writer(new AttributeWriter(getAndResetInitAttributeManager()));
{
- vespalib::LockGuard guard(_configLock);
+ std::lock_guard<std::mutex> guard(_configMutex);
initFeedView(writer, configSnapshot);
}
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
index 19469257c6a..8688b446644 100644
--- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
@@ -41,7 +41,6 @@ LOG_SETUP(".proton.server.proton");
using document::DocumentTypeRepo;
using vespalib::FileHeader;
using vespalib::IllegalStateException;
-using vespalib::LockGuard;
using vespalib::MonitorGuard;
using vespalib::RWLockReader;
using vespalib::RWLockWriter;
@@ -197,7 +196,7 @@ Proton::Proton(const config::ConfigUri & configUri,
_activeConfigSnapshot(),
_activeConfigSnapshotGeneration(0),
_pendingConfigSnapshot(),
- _configLock(),
+ _configMutex(),
_queryLimiter(),
_clock(0.010),
_threadPool(128 * 1024),
@@ -407,7 +406,7 @@ Proton::getActiveConfigSnapshot() const
{
BootstrapConfig::SP result;
{
- LockGuard guard(_configLock);
+ lock_guard guard(_configMutex);
result = _activeConfigSnapshot;
}
return result;
@@ -430,7 +429,7 @@ Proton::reconfigure(const BootstrapConfig::SP & config)
{
_pendingConfigSnapshot.set(config);
{
- LockGuard guard(_configLock);
+ lock_guard guard(_configMutex);
if (_activeConfigSnapshot.get() == NULL)
return;
if (!_allowReconfig)
@@ -451,7 +450,7 @@ Proton::performReconfig()
bool generationChanged = false;
bool snapChanged = false;
{
- LockGuard guard(_configLock);
+ lock_guard guard(_configMutex);
if (_activeConfigSnapshotGeneration != configSnapshot->getGeneration())
generationChanged = true;
if (_activeConfigSnapshot.get() != configSnapshot.get()) {
@@ -522,7 +521,7 @@ Proton::applyConfig(const BootstrapConfig::SP & configSnapshot,
removeDocumentDB(docTypeName);
}
{
- LockGuard guard(_configLock);
+ lock_guard guard(_configMutex);
_activeConfigSnapshot = configSnapshot;
_activeConfigSnapshotGeneration = configSnapshot->getGeneration();
}
@@ -575,7 +574,7 @@ Proton::~Proton()
}
_protonConfigurer.close();
{
- LockGuard guard(_configLock);
+ lock_guard guard(_configMutex);
_allowReconfig = false;
}
_executor.sync();
@@ -1027,7 +1026,7 @@ Proton::getConfigGeneration(void)
int64_t g = 0;
std::vector<DocumentDB::SP> dbs;
{
- LockGuard guard(_configLock);
+ lock_guard guard(_configMutex);
g = _activeConfigSnapshot->getGeneration();
}
{
diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.h b/searchcore/src/vespa/searchcore/proton/server/proton.h
index ad2a0b06113..e402de68752 100644
--- a/searchcore/src/vespa/searchcore/proton/server/proton.h
+++ b/searchcore/src/vespa/searchcore/proton/server/proton.h
@@ -33,6 +33,7 @@
#include <vespa/vespalib/net/state_server.h>
#include <vespa/vespalib/util/rwlock.h>
#include <vespa/vespalib/util/varholder.h>
+#include <mutex>
namespace proton {
@@ -62,6 +63,7 @@ private:
typedef std::shared_ptr<FastOS_DynamicLibrary> DynamicLibrarySP;
typedef std::map<vespalib::string, DynamicLibrarySP> LibraryMap;
using InitializeThreads = std::shared_ptr<vespalib::ThreadStackExecutorBase>;
+ using lock_guard = std::lock_guard<std::mutex>;
struct MetricsUpdateHook : metrics::UpdateHook
{
@@ -128,7 +130,7 @@ private:
BootstrapConfig::SP _activeConfigSnapshot;
int64_t _activeConfigSnapshotGeneration;
vespalib::VarHolder<BootstrapConfig::SP> _pendingConfigSnapshot;
- vespalib::Lock _configLock;
+ mutable std::mutex _configMutex;
matching::QueryLimiter _queryLimiter;
vespalib::Clock _clock;
FastOS_ThreadPool _threadPool;
diff --git a/searchcore/src/vespa/searchcore/proton/server/protonconfigurer.cpp b/searchcore/src/vespa/searchcore/proton/server/protonconfigurer.cpp
index 83e744149f3..57689abc235 100644
--- a/searchcore/src/vespa/searchcore/proton/server/protonconfigurer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/protonconfigurer.cpp
@@ -18,7 +18,7 @@ ProtonConfigurer::ProtonConfigurer(const config::ConfigUri & configUri, IBootstr
: _bootstrapConfigManager(configUri.getConfigId()),
_retriever(_bootstrapConfigManager.createConfigKeySet(), configUri.getContext(), subscribeTimeout),
_bootstrapOwner(owner),
- _lock(),
+ _mutex(),
_dbManagerMap(),
_documentDBOwnerMap(),
_threadPool(128 * 1024, 1)
@@ -52,7 +52,7 @@ ProtonConfigurer::pruneManagerMap(const BootstrapConfig::SP & config)
DBManagerMap newMap;
ConfigKeySet set;
- vespalib::LockGuard guard(_lock);
+ lock_guard guard(_mutex);
for (size_t i = 0; i < protonConfig.documentdb.size(); i++) {
const ProtonConfig::Documentdb & ddb(protonConfig.documentdb[i]);
DocTypeName docTypeName(ddb.inputdoctypename);
@@ -82,7 +82,7 @@ ProtonConfigurer::reconfigureBootstrap(const ConfigSnapshot & snapshot)
void
ProtonConfigurer::updateDocumentDBConfigs(const BootstrapConfig::SP & bootstrapConfig, const ConfigSnapshot & snapshot)
{
- vespalib::LockGuard guard(_lock);
+ lock_guard guard(_mutex);
for (DBManagerMap::iterator it(_dbManagerMap.begin()), mt(_dbManagerMap.end());
it != mt;
it++) {
@@ -94,7 +94,7 @@ ProtonConfigurer::updateDocumentDBConfigs(const BootstrapConfig::SP & bootstrapC
void
ProtonConfigurer::reconfigureDocumentDBs()
{
- vespalib::LockGuard guard(_lock);
+ lock_guard guard(_mutex);
for (DocumentDBOwnerMap::iterator it(_documentDBOwnerMap.begin()), mt(_documentDBOwnerMap.end());
it != mt;
it++) {
@@ -184,7 +184,7 @@ ProtonConfigurer::close()
void
ProtonConfigurer::registerDocumentDB(const DocTypeName & docTypeName, IDocumentDBConfigOwner * owner)
{
- vespalib::LockGuard guard(_lock);
+ lock_guard guard(_mutex);
assert(_documentDBOwnerMap.find(docTypeName) == _documentDBOwnerMap.end());
LOG(debug, "Registering new document db with checker");
_documentDBOwnerMap[docTypeName] = owner;
@@ -193,7 +193,7 @@ ProtonConfigurer::registerDocumentDB(const DocTypeName & docTypeName, IDocumentD
void
ProtonConfigurer::unregisterDocumentDB(const DocTypeName & docTypeName)
{
- vespalib::LockGuard guard(_lock);
+ lock_guard guard(_mutex);
LOG(debug, "Removing document db from checker");
assert(_documentDBOwnerMap.find(docTypeName) != _documentDBOwnerMap.end());
_documentDBOwnerMap.erase(docTypeName);
@@ -202,7 +202,7 @@ ProtonConfigurer::unregisterDocumentDB(const DocTypeName & docTypeName)
DocumentDBConfig::SP
ProtonConfigurer::getDocumentDBConfig(const DocTypeName & docTypeName) const
{
- vespalib::LockGuard guard(_lock);
+ lock_guard guard(_mutex);
DBManagerMap::const_iterator it(_dbManagerMap.find(docTypeName));
if (it == _dbManagerMap.end())
return DocumentDBConfig::SP();
diff --git a/searchcore/src/vespa/searchcore/proton/server/protonconfigurer.h b/searchcore/src/vespa/searchcore/proton/server/protonconfigurer.h
index d3e0432e95e..c2aa5abe444 100644
--- a/searchcore/src/vespa/searchcore/proton/server/protonconfigurer.h
+++ b/searchcore/src/vespa/searchcore/proton/server/protonconfigurer.h
@@ -76,7 +76,8 @@ private:
config::ConfigRetriever _retriever;
IBootstrapOwner * _bootstrapOwner;
- vespalib::Lock _lock; // Protects maps
+ mutable std::mutex _mutex; // Protects maps
+ using lock_guard = std::lock_guard<std::mutex>;
DBManagerMap _dbManagerMap;
DocumentDBOwnerMap _documentDBOwnerMap;
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
index f81dde65523..e543e89c618 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
@@ -232,7 +232,7 @@ SearchableDocSubDB::initViews(const DocumentDBConfig &configSnapshot,
IAttributeWriter::SP attrWriter(new AttributeWriter(attrMgr));
{
- vespalib::LockGuard guard(_configLock);
+ std::lock_guard<std::mutex> guard(_configMutex);
initFeedView(attrWriter, configSnapshot);
}
if (_addMetrics) {
@@ -286,7 +286,7 @@ reconfigure(vespalib::Closure0<bool>::UP closure)
void
SearchableDocSubDB::reconfigureIndexSearchable()
{
- vespalib::LockGuard guard(_configLock);
+ std::lock_guard<std::mutex> guard(_configMutex);
// Create new views as needed.
_configurer.reconfigureIndexSearchable();
// Activate new feed view at once
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
index f171306c242..dc3cf797a7b 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
@@ -78,7 +78,7 @@ StoreOnlyDocSubDB::StoreOnlyDocSubDB(const Config &cfg, const Context &ctx)
_metrics(ctx._metrics),
_iSearchView(),
_iFeedView(),
- _configLock(ctx._configLock),
+ _configMutex(ctx._configMutex),
_hwInfo(ctx._hwInfo),
_getSerialNum(ctx._getSerialNum),
_tlsSyncer(ctx._writeService.master(), ctx._getSerialNum, ctx._tlSyncer),
@@ -336,7 +336,7 @@ StoreOnlyDocSubDB::initViews(const DocumentDBConfig &configSnapshot,
assert(_writeService.master().isCurrentThread());
_iSearchView.set(ISearchHandler::SP(new EmptySearchView));
{
- vespalib::LockGuard guard(_configLock);
+ std::lock_guard<std::mutex> guard(_configMutex);
initFeedView(configSnapshot);
}
(void) sessionManager;
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h
index 2ccb3a75ebf..1759f29f7d3 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h
@@ -19,6 +19,7 @@
#include <vespa/searchcore/proton/persistenceengine/i_document_retriever.h>
#include <vespa/searchlib/common/fileheadercontext.h>
#include <vespa/vespalib/util/varholder.h>
+#include <mutex>
namespace proton {
@@ -133,7 +134,7 @@ public:
std::shared_ptr<BucketDBOwner> _bucketDB;
bucketdb::IBucketDBHandlerInitializer &_bucketDBHandlerInitializer;
LegacyDocumentDBMetrics &_metrics;
- vespalib::Lock &_configLock;
+ std::mutex &_configMutex;
const HwInfo &_hwInfo;
Context(IDocumentSubDB::IOwner &owner,
@@ -146,7 +147,7 @@ public:
bucketdb::IBucketDBHandlerInitializer &
bucketDBHandlerInitializer,
LegacyDocumentDBMetrics &metrics,
- vespalib::Lock &configLock,
+ std::mutex &configMutex,
const HwInfo &hwInfo)
: _owner(owner),
_tlSyncer(tlSyncer),
@@ -157,7 +158,7 @@ public:
_bucketDB(bucketDB),
_bucketDBHandlerInitializer(bucketDBHandlerInitializer),
_metrics(metrics),
- _configLock(configLock),
+ _configMutex(configMutex),
_hwInfo(hwInfo)
{ }
};
@@ -187,7 +188,7 @@ protected:
LegacyDocumentDBMetrics &_metrics;
vespalib::VarHolder<ISearchHandler::SP> _iSearchView;
vespalib::VarHolder<IFeedView::SP> _iFeedView;
- vespalib::Lock &_configLock;
+ std::mutex &_configMutex;
HwInfo _hwInfo;
private:
const IGetSerialNum &_getSerialNum;