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
Increase granularity of locking during collection drop.
Kishore Nallanc1e8da040f7f
diff --git a/src/collection_manager.cpp b/src/collection_manager.cppindex 024cfea8..44e671c0 100644--- a/src/collection_manager.cpp+++ b/src/collection_manager.cpp@@ -426,8 +426,7 @@ std::vector<Collection*> CollectionManager::get_collections() const {}Option<nlohmann::json> CollectionManager::drop_collection(const std::string& collection_name, const bool remove_from_store) {- std::unique_lock lock(mutex);-+ std::shared_lock s_lock(mutex);auto collection = get_collection_unsafe(collection_name);if(collection == nullptr) {@@ -469,9 +468,14 @@ Option<nlohmann::json> CollectionManager::drop_collection(const std::string& colstore->remove(Collection::get_meta_key(actual_coll_name));}+ s_lock.unlock();++ std::unique_lock u_lock(mutex);collections.erase(actual_coll_name);collection_id_names.erase(collection->get_collection_id());+ u_lock.unlock();+ // don't hold any collection manager locks here, since this can take some timedelete collection;return Option<nlohmann::json>(collection_json);