mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-05 10:22:41 +08:00
feat(db): add serialization mutex
Former-commit-id: f8a3b14c0209a9e36b0510ce48754deefc4ee442
This commit is contained in:
parent
f7cd398c3b
commit
486c175b4e
@ -342,6 +342,7 @@ void DBImpl::background_build_index() {
|
||||
|
||||
Status DBImpl::try_build_index() {
|
||||
if (bg_build_index_started_) return Status::OK();
|
||||
if (_shutting_down.load(std::memory_order_acquire)) return Status::OK();
|
||||
bg_build_index_started_ = true;
|
||||
std::thread build_index_task(&DBImpl::background_build_index, this);
|
||||
build_index_task.detach();
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
|
||||
#include <wrapper/Index.h>
|
||||
#include <cache/CpuCacheMgr.h>
|
||||
#include <easylogging++.h>
|
||||
|
||||
#include "MemManager.h"
|
||||
#include "Meta.h"
|
||||
@ -135,6 +136,7 @@ Status MemManager::mark_memory_as_immutable() {
|
||||
|
||||
Status MemManager::serialize(std::vector<std::string>& group_ids) {
|
||||
mark_memory_as_immutable();
|
||||
std::unique_lock<std::mutex> lock(serialization_mtx_);
|
||||
std::string group_id;
|
||||
group_ids.clear();
|
||||
for (auto& mem : _immMems) {
|
||||
|
||||
@ -80,6 +80,7 @@ private:
|
||||
std::shared_ptr<meta::Meta> _pMeta;
|
||||
Options options_;
|
||||
std::mutex _mutex;
|
||||
std::mutex serialization_mtx_;
|
||||
}; // MemManager
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user