Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences
C++ algoliadatastoreelasticsearchenterprise-searchfacetingfull-text-searchfuzzy-searchgeosearchin-memoryinstantsearchmerchandisingpineconesearchsearch-enginesemantic-searchsimilarity-searchsite-searchsynonymstypo-tolerancevector-search
Fine grain locking for collection creation.
Kishore Nallanf9f05666065d
diff --git a/include/collection_manager.h b/include/collection_manager.hindex 6c4f8e1f..03ef6b43 100644--- a/include/collection_manager.h+++ b/include/collection_manager.h@@ -53,6 +53,8 @@ class CollectionManager {private:mutable std::shared_mutex mutex;+ mutable std::mutex coll_create_mutex;+Store *store;ThreadPool* thread_pool;diff --git a/src/collection_manager.cpp b/src/collection_manager.cppindex fd81ae55..126d4824 100644--- a/src/collection_manager.cpp+++ b/src/collection_manager.cpp@@ -331,7 +331,7 @@ Option<Collection*> CollectionManager::create_collection(const std::string& nameconst std::vector<std::string>& symbols_to_index,const std::vector<std::string>& token_separators,const bool enable_nested_fields) {- std::unique_lock lock(mutex);+ std::unique_lock lock(coll_create_mutex);if(store->contains(Collection::get_meta_key(name))) {return Option<Collection*>(409, std::string("A collection with name `") + name + "` already exists.");@@ -382,7 +382,6 @@ Option<Collection*> CollectionManager::create_collection(const std::string& namereturn Option<Collection*>(500, "Could not write to on-disk storage.");}- lock.unlock();add_to_collections(new_collection);return Option<Collection*>(new_collection);