fix: make json path index non exists offsets compatible with 2.5 (#43691)

issue: https://github.com/milvus-io/milvus/issues/43666

---------

Signed-off-by: sunby <sunbingyi1992@gmail.com>
This commit is contained in:
Bingyi Sun 2025-08-01 23:22:23 +08:00 committed by GitHub
parent bdd65871ea
commit b59bc5e2c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 3 deletions

View File

@ -52,8 +52,8 @@ class PhyExistsFilterExpr : public SegmentExpr {
DataType::NONE,
active_count,
batch_size,
true,
consistency_level),
consistency_level,
true),
expr_(expr) {
}

View File

@ -97,6 +97,7 @@ template <typename T>
void
JsonInvertedIndex<T>::LoadIndexMetas(
const std::vector<std::string>& index_files, const Config& config) {
InvertedIndexTantivy<T>::LoadIndexMetas(index_files, config);
auto fill_non_exist_offset = [&](const uint8_t* data, int64_t size) {
non_exist_offsets_.resize((size_t)size / sizeof(size_t));
memcpy(non_exist_offsets_.data(), data, (size_t)size);
@ -138,8 +139,16 @@ JsonInvertedIndex<T>::LoadIndexMetas(
fill_non_exist_offset(non_exist_offset_codec->PayloadData(),
non_exist_offset_codec->PayloadSize());
}
return;
}
InvertedIndexTantivy<T>::LoadIndexMetas(index_files, config);
// Fallback: no non_exist_offset_file found. This occurs in two scenarios:
// 1. Legacy v2.5.x data where non_exist_offset_file doesn't exist
// 2. All records are valid (no invalid offsets to track)
//
// Use null_offset_ as the source for non_exist_offsets_ to maintain
// backward compatibility. This ensures Exists() behaves like v2.5.x IsNotNull().
non_exist_offsets_ = this->null_offset_;
}
template <typename T>