diff --git a/CHANGELOG.md b/CHANGELOG.md index d69a89dad18af895f702cd4b5546a899f71fe0b1..043f19839260ee7289ec8383dfd4b74c64b23cde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ Please mark all changes in change log and use the issue from GitHub - \#2869 Create index failed with binary vectors - \#2893 Insert binary data failed - \#2957 There is no exisitence check of annoy search parameter +- \#3407 Server get stuck if create index after entities inserted with no manual flush ## Feature - \#2319 Redo metadata to support MVCC diff --git a/core/src/server/ValidationUtil.cpp b/core/src/server/ValidationUtil.cpp index 329d18c3c9a56fdc77c2da24aa42ad30e4c3aee4..372e1a5b9bcc93791be4769c83a5d4462d98b896 100644 --- a/core/src/server/ValidationUtil.cpp +++ b/core/src/server/ValidationUtil.cpp @@ -362,15 +362,15 @@ ValidateIndexMetricType(const std::string& metric_type, const std::string& index milvus::knowhere::Metric::SUPERSTRUCTURE, }; - if (index_type == knowhere::IndexEnum::INDEX_FAISS_IDMAP || - index_type == knowhere::IndexEnum::INDEX_FAISS_BIN_IDMAP) { + if (index_type == knowhere::IndexEnum::INDEX_FAISS_IDMAP) { if (s_valid_metric.find(metric_type) == s_valid_metric.end()) { std::string msg = "Invalid index metric type: " + metric_type + ". " + "Make sure the metric type is in MetricType list."; LOG_SERVER_ERROR_ << msg; return Status(SERVER_INVALID_INDEX_METRIC_TYPE, msg); } - } else if (index_type == knowhere::IndexEnum::INDEX_FAISS_BIN_IVFFLAT) { + } else if (index_type == knowhere::IndexEnum::INDEX_FAISS_BIN_IVFFLAT || + index_type == knowhere::IndexEnum::INDEX_FAISS_BIN_IDMAP) { // binary if (metric_type != knowhere::Metric::HAMMING && metric_type != knowhere::Metric::JACCARD && metric_type != knowhere::Metric::TANIMOTO) { diff --git a/tests/milvus_python_test/test_index.py b/tests/milvus_python_test/test_index.py index 871dbe931c44f7078e4749f53d1fbdd143217584..ebf9bd0f590d189190ab3440a309a6ec4e95bf16 100644 --- a/tests/milvus_python_test/test_index.py +++ b/tests/milvus_python_test/test_index.py @@ -513,6 +513,14 @@ class TestIndexBinary: else: pytest.skip("Skip index") + @pytest.fixture( + scope="function", + params=gen_binary_index() + ) + def get_l2_index(self, request, connect): + request.param["metric_type"] = "L2" + return request.param + @pytest.fixture( scope="function", params=[ @@ -567,6 +575,20 @@ class TestIndexBinary: res = connect.search(binary_collection, query, search_params=search_param) assert len(res) == nq + @pytest.mark.timeout(BUILD_TIMEOUT) + def test_create_index_invalid_metric_type_binary(self, connect, binary_collection, get_l2_index): + ''' + target: test create index interface with invalid metric type + method: add entitys into binary connection, flash, create index with L2 metric type. + expected: return create_index failure + ''' + # insert 6000 vectors + ids = connect.insert(binary_collection, binary_entities) + connect.flush([binary_collection]) + + with pytest.raises(Exception) as e: + res = connect.create_index(binary_collection, binary_field_name, get_l2_index) + """ ****************************************************************** The following cases are used to test `get_index_info` function