mirror of https://github.com/milvus-io/milvus.git
Fix Server get stuck if create index with invalide metric types after entities inserted (#3428)
* add create index with invalid metric type case Signed-off-by: yangxuan <xuan.yang@zilliz.com> * fix bin index validation Signed-off-by: yangxuan <xuan.yang@zilliz.com> * change changelog Signed-off-by: yangxuan <xuan.yang@zilliz.com> Co-authored-by: yangxuan <xuan.yang@zilliz.com>pull/3450/head
parent
6133c095ca
commit
7326784e30
|
@ -29,6 +29,7 @@ Please mark all changes in change log and use the issue from GitHub
|
||||||
- \#2869 Create index failed with binary vectors
|
- \#2869 Create index failed with binary vectors
|
||||||
- \#2893 Insert binary data failed
|
- \#2893 Insert binary data failed
|
||||||
- \#2957 There is no exisitence check of annoy search parameter
|
- \#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
|
## Feature
|
||||||
- \#2319 Redo metadata to support MVCC
|
- \#2319 Redo metadata to support MVCC
|
||||||
|
|
|
@ -362,15 +362,15 @@ ValidateIndexMetricType(const std::string& metric_type, const std::string& index
|
||||||
milvus::knowhere::Metric::SUPERSTRUCTURE,
|
milvus::knowhere::Metric::SUPERSTRUCTURE,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (index_type == knowhere::IndexEnum::INDEX_FAISS_IDMAP ||
|
if (index_type == knowhere::IndexEnum::INDEX_FAISS_IDMAP) {
|
||||||
index_type == knowhere::IndexEnum::INDEX_FAISS_BIN_IDMAP) {
|
|
||||||
if (s_valid_metric.find(metric_type) == s_valid_metric.end()) {
|
if (s_valid_metric.find(metric_type) == s_valid_metric.end()) {
|
||||||
std::string msg =
|
std::string msg =
|
||||||
"Invalid index metric type: " + metric_type + ". " + "Make sure the metric type is in MetricType list.";
|
"Invalid index metric type: " + metric_type + ". " + "Make sure the metric type is in MetricType list.";
|
||||||
LOG_SERVER_ERROR_ << msg;
|
LOG_SERVER_ERROR_ << msg;
|
||||||
return Status(SERVER_INVALID_INDEX_METRIC_TYPE, 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
|
// binary
|
||||||
if (metric_type != knowhere::Metric::HAMMING && metric_type != knowhere::Metric::JACCARD &&
|
if (metric_type != knowhere::Metric::HAMMING && metric_type != knowhere::Metric::JACCARD &&
|
||||||
metric_type != knowhere::Metric::TANIMOTO) {
|
metric_type != knowhere::Metric::TANIMOTO) {
|
||||||
|
|
|
@ -513,6 +513,14 @@ class TestIndexBinary:
|
||||||
else:
|
else:
|
||||||
pytest.skip("Skip index")
|
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(
|
@pytest.fixture(
|
||||||
scope="function",
|
scope="function",
|
||||||
params=[
|
params=[
|
||||||
|
@ -567,6 +575,20 @@ class TestIndexBinary:
|
||||||
res = connect.search(binary_collection, query, search_params=search_param)
|
res = connect.search(binary_collection, query, search_params=search_param)
|
||||||
assert len(res) == nq
|
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
|
The following cases are used to test `get_index_info` function
|
||||||
|
|
Loading…
Reference in New Issue