diff options
10 files changed, 37 insertions, 37 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.cpp index 5f057bbd7dc..246caa6cd35 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.cpp @@ -23,7 +23,7 @@ std::vector<vespalib::string> AttributeDiskLayout::listAttributes() { std::vector<vespalib::string> attributes; - std::shared_lock<std::shared_timed_mutex> guard(_mutex); + std::shared_lock<std::shared_mutex> guard(_mutex); for (const auto &dir : _dirs) { attributes.emplace_back(dir.first); } @@ -46,7 +46,7 @@ AttributeDiskLayout::scanDir() std::shared_ptr<AttributeDirectory> AttributeDiskLayout::getAttributeDir(const vespalib::string &name) { - std::shared_lock<std::shared_timed_mutex> guard(_mutex); + std::shared_lock<std::shared_mutex> guard(_mutex); auto itr = _dirs.find(name); if (itr == _dirs.end()) { return std::shared_ptr<AttributeDirectory>(); @@ -58,7 +58,7 @@ AttributeDiskLayout::getAttributeDir(const vespalib::string &name) std::shared_ptr<AttributeDirectory> AttributeDiskLayout::createAttributeDir(const vespalib::string &name) { - std::lock_guard<std::shared_timed_mutex> guard(_mutex); + std::lock_guard<std::shared_mutex> guard(_mutex); auto itr = _dirs.find(name); if (itr == _dirs.end()) { auto dir = std::make_shared<AttributeDirectory>(shared_from_this(), name); @@ -80,7 +80,7 @@ AttributeDiskLayout::removeAttributeDir(const vespalib::string &name, search::Se writer->invalidateOldSnapshots(serialNum); writer->removeInvalidSnapshots(); if (writer->removeDiskDir()) { - std::lock_guard<std::shared_timed_mutex> guard(_mutex); + std::lock_guard<std::shared_mutex> guard(_mutex); auto itr = _dirs.find(name); assert(itr != _dirs.end()); assert(dir.get() == itr->second.get()); @@ -88,7 +88,7 @@ AttributeDiskLayout::removeAttributeDir(const vespalib::string &name, search::Se writer->detach(); } } else { - std::lock_guard<std::shared_timed_mutex> guard(_mutex); + std::lock_guard<std::shared_mutex> guard(_mutex); auto itr = _dirs.find(name); if (itr != _dirs.end()) { assert(dir.get() != itr->second.get()); diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.h b/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.h index 9e081f601bf..74cf0bb8cf8 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributedisklayout.h @@ -19,7 +19,7 @@ class AttributeDiskLayout : public std::enable_shared_from_this<AttributeDiskLay { private: const vespalib::string _baseDir; - mutable std::shared_timed_mutex _mutex; + mutable std::shared_mutex _mutex; std::map<vespalib::string, std::shared_ptr<AttributeDirectory>> _dirs; void scanDir(); diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp b/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp index 96ecccb0e6d..1ac313f2718 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp @@ -740,7 +740,7 @@ PersistenceEngine::populateInitialBucketDB(const WriteGuard & guard, BucketSpace trHandler.await(); } -std::unique_lock<std::shared_timed_mutex> +std::unique_lock<std::shared_mutex> PersistenceEngine::getWLock() const { return WriteGuard(_rwMutex); diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.h b/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.h index 27ebffd4ee3..9ee42823f9c 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.h +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.h @@ -70,10 +70,10 @@ private: const IResourceWriteFilter &_writeFilter; std::unordered_map<BucketSpace, ClusterState::SP, BucketSpace::hash> _clusterStates; mutable ExtraModifiedBuckets _extraModifiedBuckets; - mutable std::shared_timed_mutex _rwMutex; + mutable std::shared_mutex _rwMutex; - using ReadGuard = std::shared_lock<std::shared_timed_mutex>; - using WriteGuard = std::unique_lock<std::shared_timed_mutex>; + using ReadGuard = std::shared_lock<std::shared_mutex>; + using WriteGuard = std::unique_lock<std::shared_mutex>; IPersistenceHandler * getHandler(const ReadGuard & guard, document::BucketSpace bucketSpace, const DocTypeName &docType) const; HandlerSnapshot getHandlerSnapshot(const WriteGuard & guard) const; diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp index c40f1263324..321662ea404 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp @@ -492,7 +492,7 @@ Proton::closeDocumentDBs(vespalib::ThreadStackExecutorBase & executor) { size_t Proton::getNumDocs() const { size_t numDocs(0); - std::shared_lock<std::shared_timed_mutex> guard(_mutex); + std::shared_lock<std::shared_mutex> guard(_mutex); for (const auto &kv : _documentDBMap) { numDocs += kv.second->getNumDocs(); } @@ -502,7 +502,7 @@ size_t Proton::getNumDocs() const size_t Proton::getNumActiveDocs() const { size_t numDocs(0); - std::shared_lock<std::shared_timed_mutex> guard(_mutex); + std::shared_lock<std::shared_mutex> guard(_mutex); for (const auto &kv : _documentDBMap) { numDocs += kv.second->getNumActiveDocs(); } @@ -532,7 +532,7 @@ Proton::getDelayedConfigs() const { std::ostringstream res; bool first = true; - std::shared_lock<std::shared_timed_mutex> guard(_mutex); + std::shared_lock<std::shared_mutex> guard(_mutex); for (const auto &kv : _documentDBMap) { if (kv.second->getDelayedConfig()) { if (!first) { @@ -549,7 +549,7 @@ StatusReport::List Proton::getStatusReports() const { StatusReport::List reports; - std::shared_lock<std::shared_timed_mutex> guard(_mutex); + std::shared_lock<std::shared_mutex> guard(_mutex); reports.push_back(StatusReport::SP(_matchEngine->reportStatus())); for (const auto &kv : _documentDBMap) { reports.push_back(StatusReport::SP(kv.second->reportStatus())); @@ -566,7 +566,7 @@ Proton::addDocumentDB(const document::DocumentType &docType, { const ProtonConfig &config(bootstrapConfig->getProtonConfig()); - std::lock_guard<std::shared_timed_mutex> guard(_mutex); + std::lock_guard<std::shared_mutex> guard(_mutex); DocTypeName docTypeName(docType.getName()); auto it = _documentDBMap.find(docTypeName); if (it != _documentDBMap.end()) { @@ -607,7 +607,7 @@ Proton::addDocumentDB(const document::DocumentType &docType, _documentDBMap[docTypeName] = ret; if (_persistenceEngine) { // Not allowed to get to service layer to call pause(). - std::unique_lock<std::shared_timed_mutex> persistenceWGuard(_persistenceEngine->getWLock()); + std::unique_lock<std::shared_mutex> persistenceWGuard(_persistenceEngine->getWLock()); auto persistenceHandler = std::make_shared<PersistenceHandlerProxy>(ret); if (!_isInitializing) { _persistenceEngine->propagateSavedClusterState(bucketSpace, *persistenceHandler); @@ -632,7 +632,7 @@ Proton::removeDocumentDB(const DocTypeName &docTypeName) { DocumentDB::SP old; { - std::lock_guard<std::shared_timed_mutex> guard(_mutex); + std::lock_guard<std::shared_mutex> guard(_mutex); auto it = _documentDBMap.find(docTypeName); if (it == _documentDBMap.end()) { return; @@ -645,7 +645,7 @@ Proton::removeDocumentDB(const DocTypeName &docTypeName) if (_persistenceEngine) { { // Not allowed to get to service layer to call pause(). - std::unique_lock<std::shared_timed_mutex> persistenceWguard(_persistenceEngine->getWLock()); + std::unique_lock<std::shared_mutex> persistenceWguard(_persistenceEngine->getWLock()); IPersistenceHandler::SP oldHandler = _persistenceEngine->removeHandler(persistenceWguard, old->getBucketSpace(), docTypeName); if (_initComplete && oldHandler) { // TODO: Fix race with bucket db modifying ops. @@ -757,7 +757,7 @@ Proton::updateMetrics(const vespalib::MonitorGuard &) void Proton::waitForInitDone() { - std::shared_lock<std::shared_timed_mutex> guard(_mutex); + std::shared_lock<std::shared_mutex> guard(_mutex); for (const auto &kv : _documentDBMap) { kv.second->waitForInitDone(); } @@ -766,7 +766,7 @@ Proton::waitForInitDone() void Proton::waitForOnlineState() { - std::shared_lock<std::shared_timed_mutex> guard(_mutex); + std::shared_lock<std::shared_mutex> guard(_mutex); for (const auto &kv : _documentDBMap) { kv.second->waitForOnlineState(); } @@ -778,7 +778,7 @@ Proton::getComponentConfig(Consumer &consumer) _protonConfigurer.getComponentConfig().getComponentConfig(consumer); std::vector<DocumentDB::SP> dbs; { - std::shared_lock<std::shared_timed_mutex> guard(_mutex); + std::shared_lock<std::shared_mutex> guard(_mutex); for (const auto &kv : _documentDBMap) { dbs.push_back(kv.second); } @@ -847,12 +847,12 @@ struct StateExplorerProxy : vespalib::StateExplorer { struct DocumentDBMapExplorer : vespalib::StateExplorer { typedef std::map<DocTypeName, DocumentDB::SP> DocumentDBMap; const DocumentDBMap &documentDBMap; - std::shared_timed_mutex &mutex; - DocumentDBMapExplorer(const DocumentDBMap &documentDBMap_in, std::shared_timed_mutex &mutex_in) + std::shared_mutex &mutex; + DocumentDBMapExplorer(const DocumentDBMap &documentDBMap_in, std::shared_mutex &mutex_in) : documentDBMap(documentDBMap_in), mutex(mutex_in) {} void get_state(const vespalib::slime::Inserter &, bool) const override {} std::vector<vespalib::string> get_children_names() const override { - std::shared_lock<std::shared_timed_mutex> guard(mutex); + std::shared_lock<std::shared_mutex> guard(mutex); std::vector<vespalib::string> names; for (const auto &item: documentDBMap) { names.push_back(item.first.getName()); @@ -861,7 +861,7 @@ struct DocumentDBMapExplorer : vespalib::StateExplorer { } std::unique_ptr<vespalib::StateExplorer> get_child(vespalib::stringref name) const override { typedef std::unique_ptr<StateExplorer> Explorer_UP; - std::shared_lock<std::shared_timed_mutex> guard(mutex); + std::shared_lock<std::shared_mutex> guard(mutex); auto result = documentDBMap.find(DocTypeName(vespalib::string(name))); if (result == documentDBMap.end()) { return Explorer_UP(nullptr); diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.h b/searchcore/src/vespa/searchcore/proton/server/proton.h index 55fd3594463..45556319e78 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.h +++ b/searchcore/src/vespa/searchcore/proton/server/proton.h @@ -86,7 +86,7 @@ private: }; const config::ConfigUri _configUri; - mutable std::shared_timed_mutex _mutex; + mutable std::shared_mutex _mutex; MetricsUpdateHook _metricsHook; std::unique_ptr<MetricsEngine> _metricsEngine; ProtonFileHeaderContext _fileHeaderContext; diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp index 08c7186e8c7..dbd5690093b 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp @@ -635,7 +635,7 @@ AttributeVector::onInitSave(vespalib::stringref) bool AttributeVector::hasActiveEnumGuards() { - std::unique_lock<std::shared_timed_mutex> lock(_enumLock, std::defer_lock); + std::unique_lock<std::shared_mutex> lock(_enumLock, std::defer_lock); for (size_t i = 0; i < 1000; ++i) { // Note: Need to run this in loop as try_lock() is allowed to fail spuriously and return false // even if the mutex is not currently locked by any other thread. @@ -735,10 +735,10 @@ class ReadGuard : public attribute::AttributeReadGuard { using GenerationHandler = vespalib::GenerationHandler; GenerationHandler::Guard _generationGuard; - using EnumGuard = std::shared_lock<std::shared_timed_mutex>; + using EnumGuard = std::shared_lock<std::shared_mutex>; EnumGuard _enumGuard; public: - ReadGuard(const attribute::IAttributeVector *attr, GenerationHandler::Guard &&generationGuard, std::shared_timed_mutex *enumLock) + ReadGuard(const attribute::IAttributeVector *attr, GenerationHandler::Guard &&generationGuard, std::shared_mutex *enumLock) : attribute::AttributeReadGuard(attr), _generationGuard(std::move(generationGuard)), _enumGuard(enumLock != nullptr ? EnumGuard(*enumLock) : EnumGuard()) diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.h b/searchlib/src/vespa/searchlib/attribute/attributevector.h index 75699868691..d8bdda911fd 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributevector.h +++ b/searchlib/src/vespa/searchlib/attribute/attributevector.h @@ -232,9 +232,9 @@ protected: public: class EnumModifier { - std::unique_lock<std::shared_timed_mutex> _enumLock; + std::unique_lock<std::shared_mutex> _enumLock; public: - EnumModifier(std::shared_timed_mutex &lock, attribute::InterlockGuard &interlockGuard) + EnumModifier(std::shared_mutex &lock, attribute::InterlockGuard &interlockGuard) : _enumLock(lock) { (void) interlockGuard; @@ -575,7 +575,7 @@ private: BaseName _baseFileName; Config _config; std::shared_ptr<attribute::Interlock> _interlock; - mutable std::shared_timed_mutex _enumLock; + mutable std::shared_mutex _enumLock; GenerationHandler _genHandler; GenerationHolder _genHolder; Status _status; @@ -606,7 +606,7 @@ private: * Used to regulate access to critical resources. Apply the * reader/writer guards. */ - std::shared_timed_mutex & getEnumLock() { return _enumLock; } + std::shared_mutex & getEnumLock() { return _enumLock; } friend class ComponentGuard<AttributeVector>; friend class AttributeValueGuard; diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp b/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp index 34461be05d1..a72731b661e 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp @@ -345,7 +345,7 @@ namespace { constexpr double NEVER(-1.0); void -writeDomainDir(std::shared_lock<std::shared_timed_mutex> &guard, +writeDomainDir(std::shared_lock<std::shared_mutex> &guard, vespalib::string dir, vespalib::string domainList, const std::map<vespalib::string, std::shared_ptr<Domain>> &domains) diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogserver.h b/searchlib/src/vespa/searchlib/transactionlog/translogserver.h index cd2d004c3cf..e8b8bcb2d81 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogserver.h +++ b/searchlib/src/vespa/searchlib/transactionlog/translogserver.h @@ -79,8 +79,8 @@ private: static const Session::SP & getSession(FRT_RPCRequest *req); using DomainList = std::map<vespalib::string, DomainSP >; - using ReadGuard = std::shared_lock<std::shared_timed_mutex>; - using WriteGuard = std::unique_lock<std::shared_timed_mutex>; + using ReadGuard = std::shared_lock<std::shared_mutex>; + using WriteGuard = std::unique_lock<std::shared_mutex>; vespalib::string _name; vespalib::string _baseDir; @@ -90,7 +90,7 @@ private: std::unique_ptr<FNET_Transport> _transport; std::unique_ptr<FRT_Supervisor> _supervisor; DomainList _domains; - mutable std::shared_timed_mutex _domainMutex;; // Protects _domains + mutable std::shared_mutex _domainMutex;; // Protects _domains std::condition_variable _domainCondition; std::mutex _fileLock; // Protects the creating and deleting domains including file system operations. document::Queue<FRT_RPCRequest *> _reqQ; |