mirror of https://github.com/milvus-io/milvus.git
enhance: mark sparse inverted index as mmap-able (#33281)
issue: #29419 Signed-off-by: Buqian Zheng <zhengbuqian@gmail.com>pull/33138/head^2
parent
229a6b942b
commit
c5918ffbdb
|
@ -81,7 +81,10 @@ class IndexBase {
|
|||
index_type_ == knowhere::IndexEnum::INDEX_FAISS_IVFSQ8 ||
|
||||
index_type_ == knowhere::IndexEnum::INDEX_FAISS_BIN_IVFFLAT ||
|
||||
index_type_ == knowhere::IndexEnum::INDEX_FAISS_IDMAP ||
|
||||
index_type_ == knowhere::IndexEnum::INDEX_FAISS_BIN_IDMAP;
|
||||
index_type_ == knowhere::IndexEnum::INDEX_FAISS_BIN_IDMAP ||
|
||||
index_type_ ==
|
||||
knowhere::IndexEnum::INDEX_SPARSE_INVERTED_INDEX ||
|
||||
index_type_ == knowhere::IndexEnum::INDEX_SPARSE_WAND;
|
||||
}
|
||||
|
||||
const IndexType&
|
||||
|
|
|
@ -570,7 +570,7 @@ TEST_P(IndexTest, Mmap) {
|
|||
load_conf["mmap_filepath"] = "mmap/test_index_mmap_" + index_type;
|
||||
vec_index->Load(milvus::tracer::TraceContext{}, load_conf);
|
||||
EXPECT_EQ(vec_index->Count(), NB);
|
||||
EXPECT_EQ(vec_index->GetDim(), DIM);
|
||||
EXPECT_EQ(vec_index->GetDim(), is_sparse ? kTestSparseDim : DIM);
|
||||
|
||||
milvus::SearchInfo search_info;
|
||||
search_info.topk_ = K;
|
||||
|
|
|
@ -259,6 +259,18 @@ GenerateRandomSparseFloatVector(size_t rows,
|
|||
|
||||
std::vector<std::map<int32_t, float>> data(rows);
|
||||
|
||||
// ensure the actual dim of the entire generated dataset is cols.
|
||||
data[0][cols - 1] = real_distrib(rng);
|
||||
--num_elements;
|
||||
|
||||
// Ensure each row has at least one non-zero value
|
||||
for (size_t i = 0; i < rows; ++i) {
|
||||
auto col = col_distrib(rng);
|
||||
float val = real_distrib(rng);
|
||||
data[i][col] = val;
|
||||
}
|
||||
num_elements -= rows;
|
||||
|
||||
for (int32_t i = 0; i < num_elements; ++i) {
|
||||
auto row = row_distrib(rng);
|
||||
while (data[row].size() == (size_t)cols) {
|
||||
|
|
|
@ -57,7 +57,9 @@ func IsMmapSupported(indexType IndexType) bool {
|
|||
indexType == IndexFaissBinIDMap ||
|
||||
indexType == IndexFaissBinIvfFlat ||
|
||||
indexType == IndexHNSW ||
|
||||
indexType == IndexScaNN
|
||||
indexType == IndexScaNN ||
|
||||
indexType == IndexSparseInverted ||
|
||||
indexType == IndexSparseWand
|
||||
}
|
||||
|
||||
func IsDiskIndex(indexType IndexType) bool {
|
||||
|
|
Loading…
Reference in New Issue