fix: inverted index null offset file not compacted (#46775)

relate: https://github.com/milvus-io/milvus/issues/46774

Signed-off-by: aoiasd <zhicheng.yue@zilliz.com>
This commit is contained in:
aoiasd 2026-01-07 11:53:24 +08:00 committed by GitHub
parent 537199fb80
commit c0664b78ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View File

@ -255,7 +255,13 @@ InvertedIndexTantivy<T>::LoadIndexMetas(
if (file_name.find(INDEX_NULL_OFFSET_FILE_NAME) != std::string::npos) {
null_offset_files.push_back(file);
}
// add slice meta file for null offset file compact
if (file_name == INDEX_FILE_SLICE_META) {
null_offset_files.push_back(file);
}
}
if (null_offset_files.size() > 0) {
// null offset file is sliced
auto index_datas = mem_file_manager_->LoadIndexToMemory(
@ -283,6 +289,10 @@ InvertedIndexTantivy<T>::RetainTantivyIndexFiles(
auto file_name =
boost::filesystem::path(file).filename().string();
return file_name == "index_type" ||
// Slice meta is only used to compact null_offset files and non_exist_offset files.
// It can be removed after compaction is complete.
// Other index files are compacted by slice index instead of meta.
file_name == INDEX_FILE_SLICE_META ||
file_name.find(INDEX_NULL_OFFSET_FILE_NAME) !=
std::string::npos;
}),

View File

@ -130,6 +130,10 @@ JsonInvertedIndex<T>::LoadIndexMetas(
std::string::npos) {
non_exist_offset_files.push_back(file);
}
// add slice meta file for null offset file compact
if (file_name == INDEX_FILE_SLICE_META) {
non_exist_offset_files.push_back(file);
}
}
if (non_exist_offset_files.size() > 0) {
// null offset file is sliced