mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
enhance: support mmap for jsonstats shared key index (#44914)
#42533 Signed-off-by: luzhang <luzhang@zilliz.com> Co-authored-by: luzhang <luzhang@zilliz.com>
This commit is contained in:
parent
b6532d3e44
commit
1b58844319
@ -1009,7 +1009,9 @@ JsonKeyStats::Load(milvus::tracer::TraceContext ctx, const Config& config) {
|
|||||||
LoadShreddingData(shredding_data_files);
|
LoadShreddingData(shredding_data_files);
|
||||||
|
|
||||||
// load shared key index
|
// load shared key index
|
||||||
bson_inverted_index_->LoadIndex(shared_key_index_files, load_priority_);
|
bson_inverted_index_->LoadIndex(shared_key_index_files,
|
||||||
|
load_priority_,
|
||||||
|
config.contains(MMAP_FILE_PATH));
|
||||||
}
|
}
|
||||||
|
|
||||||
IndexStatsPtr
|
IndexStatsPtr
|
||||||
|
|||||||
@ -104,7 +104,8 @@ BsonInvertedIndex::BuildIndex() {
|
|||||||
|
|
||||||
void
|
void
|
||||||
BsonInvertedIndex::LoadIndex(const std::vector<std::string>& index_files,
|
BsonInvertedIndex::LoadIndex(const std::vector<std::string>& index_files,
|
||||||
milvus::proto::common::LoadPriority priority) {
|
milvus::proto::common::LoadPriority priority,
|
||||||
|
bool load_in_mmap) {
|
||||||
if (is_load_) {
|
if (is_load_) {
|
||||||
// convert shared_key_index/... to remote_prefix/shared_key_index/...
|
// convert shared_key_index/... to remote_prefix/shared_key_index/...
|
||||||
std::vector<std::string> remote_files;
|
std::vector<std::string> remote_files;
|
||||||
@ -122,10 +123,17 @@ BsonInvertedIndex::LoadIndex(const std::vector<std::string>& index_files,
|
|||||||
"index dir not exist: {}",
|
"index dir not exist: {}",
|
||||||
path_);
|
path_);
|
||||||
wrapper_ = std::make_shared<TantivyIndexWrapper>(
|
wrapper_ = std::make_shared<TantivyIndexWrapper>(
|
||||||
path_.c_str(), false, milvus::index::SetBitsetUnused);
|
path_.c_str(), load_in_mmap, milvus::index::SetBitsetUnused);
|
||||||
LOG_INFO("load json shared key index done for field id:{} with dir:{}",
|
|
||||||
|
if (!load_in_mmap) {
|
||||||
|
disk_file_manager_->RemoveJsonStatsSharedIndexFiles();
|
||||||
|
}
|
||||||
|
LOG_INFO(
|
||||||
|
"load json shared key index done for field id:{} with "
|
||||||
|
"dir:{},load_in_mmap:{}",
|
||||||
field_id_,
|
field_id_,
|
||||||
path_);
|
path_,
|
||||||
|
load_in_mmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -57,7 +57,8 @@ class BsonInvertedIndex {
|
|||||||
|
|
||||||
void
|
void
|
||||||
LoadIndex(const std::vector<std::string>& index_files,
|
LoadIndex(const std::vector<std::string>& index_files,
|
||||||
milvus::proto::common::LoadPriority priority);
|
milvus::proto::common::LoadPriority priority,
|
||||||
|
bool load_in_mmap);
|
||||||
|
|
||||||
IndexStatsPtr
|
IndexStatsPtr
|
||||||
UploadIndex();
|
UploadIndex();
|
||||||
|
|||||||
@ -738,6 +738,13 @@ DiskFileManagerImpl::RemoveTextLogFiles() {
|
|||||||
local_chunk_manager->RemoveDir(GetLocalTextIndexPrefix());
|
local_chunk_manager->RemoveDir(GetLocalTextIndexPrefix());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DiskFileManagerImpl::RemoveJsonStatsSharedIndexFiles() {
|
||||||
|
auto local_chunk_manager =
|
||||||
|
LocalChunkManagerSingleton::GetInstance().GetChunkManager();
|
||||||
|
local_chunk_manager->RemoveDir(GetLocalJsonStatsSharedIndexPrefix());
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DiskFileManagerImpl::RemoveJsonStatsFiles() {
|
DiskFileManagerImpl::RemoveJsonStatsFiles() {
|
||||||
auto local_chunk_manager =
|
auto local_chunk_manager =
|
||||||
|
|||||||
@ -173,6 +173,9 @@ class DiskFileManagerImpl : public FileManagerImpl {
|
|||||||
void
|
void
|
||||||
RemoveTextLogFiles();
|
RemoveTextLogFiles();
|
||||||
|
|
||||||
|
void
|
||||||
|
RemoveJsonStatsSharedIndexFiles();
|
||||||
|
|
||||||
void
|
void
|
||||||
RemoveJsonStatsFiles();
|
RemoveJsonStatsFiles();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user