mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 09:08:43 +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);
|
||||
|
||||
// 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
|
||||
|
||||
@ -104,7 +104,8 @@ BsonInvertedIndex::BuildIndex() {
|
||||
|
||||
void
|
||||
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_) {
|
||||
// convert shared_key_index/... to remote_prefix/shared_key_index/...
|
||||
std::vector<std::string> remote_files;
|
||||
@ -122,10 +123,17 @@ BsonInvertedIndex::LoadIndex(const std::vector<std::string>& index_files,
|
||||
"index dir not exist: {}",
|
||||
path_);
|
||||
wrapper_ = std::make_shared<TantivyIndexWrapper>(
|
||||
path_.c_str(), false, milvus::index::SetBitsetUnused);
|
||||
LOG_INFO("load json shared key index done for field id:{} with dir:{}",
|
||||
path_.c_str(), load_in_mmap, milvus::index::SetBitsetUnused);
|
||||
|
||||
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_,
|
||||
path_);
|
||||
path_,
|
||||
load_in_mmap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -57,7 +57,8 @@ class BsonInvertedIndex {
|
||||
|
||||
void
|
||||
LoadIndex(const std::vector<std::string>& index_files,
|
||||
milvus::proto::common::LoadPriority priority);
|
||||
milvus::proto::common::LoadPriority priority,
|
||||
bool load_in_mmap);
|
||||
|
||||
IndexStatsPtr
|
||||
UploadIndex();
|
||||
|
||||
@ -738,6 +738,13 @@ DiskFileManagerImpl::RemoveTextLogFiles() {
|
||||
local_chunk_manager->RemoveDir(GetLocalTextIndexPrefix());
|
||||
}
|
||||
|
||||
void
|
||||
DiskFileManagerImpl::RemoveJsonStatsSharedIndexFiles() {
|
||||
auto local_chunk_manager =
|
||||
LocalChunkManagerSingleton::GetInstance().GetChunkManager();
|
||||
local_chunk_manager->RemoveDir(GetLocalJsonStatsSharedIndexPrefix());
|
||||
}
|
||||
|
||||
void
|
||||
DiskFileManagerImpl::RemoveJsonStatsFiles() {
|
||||
auto local_chunk_manager =
|
||||
|
||||
@ -173,6 +173,9 @@ class DiskFileManagerImpl : public FileManagerImpl {
|
||||
void
|
||||
RemoveTextLogFiles();
|
||||
|
||||
void
|
||||
RemoveJsonStatsSharedIndexFiles();
|
||||
|
||||
void
|
||||
RemoveJsonStatsFiles();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user