milvus icon indicating copy to clipboard operation
milvus copied to clipboard

[Bug]: [Nightly] High level api search using inconsistent metric_type does not report error

Open NicoYuan1986 opened this issue 1 year ago • 9 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Environment

- Milvus version: master-20240110-d6429933
- Deployment mode(standalone or cluster): cluster
- MQ type(rocksmq, pulsar or kafka):    kafka
- SDK version(e.g. pymilvus v2.0.0rc2): 2.4.0rc16
- OS(Ubuntu or CentOS): 
- CPU/Memory: 
- GPU: 
- Others:

Current Behavior

High level api search using inconsistent metric_type does not report error.

[2024-01-10T19:50:50.883Z] ____ TestHighLevelApi.test_high_level_search_not_consistent_metric_type[L2] ____
[2024-01-10T19:50:50.883Z] [gw2] linux -- Python 3.8.17 /usr/local/bin/python3
[2024-01-10T19:50:50.883Z] 
[2024-01-10T19:50:50.883Z] self = <test_high_level_api.TestHighLevelApi object at 0x7f7f048439a0>
[2024-01-10T19:50:50.883Z] metric_type = 'L2'
[2024-01-10T19:50:50.883Z] 
[2024-01-10T19:50:50.883Z]     @pytest.mark.tags(CaseLabel.L2)
[2024-01-10T19:50:50.883Z]     def test_high_level_search_not_consistent_metric_type(self, metric_type):
[2024-01-10T19:50:50.883Z]         """
[2024-01-10T19:50:50.883Z]         target: test search with inconsistent metric type (default is IP) with that of index
[2024-01-10T19:50:50.883Z]         method: create connection, collection, insert and search with not consistent metric type
[2024-01-10T19:50:50.883Z]         expected: Raise exception
[2024-01-10T19:50:50.883Z]         """
[2024-01-10T19:50:50.883Z]         client = self._connect(enable_high_level_api=True)
[2024-01-10T19:50:50.883Z]         collection_name = cf.gen_unique_str(prefix)
[2024-01-10T19:50:50.883Z]         # 1. create collection
[2024-01-10T19:50:50.883Z]         client_w.create_collection(client, collection_name, default_dim)
[2024-01-10T19:50:50.883Z]         # 2. search
[2024-01-10T19:50:50.883Z]         rng = np.random.default_rng(seed=19530)
[2024-01-10T19:50:50.883Z]         vectors_to_search = rng.random((1, 8))
[2024-01-10T19:50:50.883Z]         search_params = {"metric_type": metric_type}
[2024-01-10T19:50:50.883Z]         error = {ct.err_code: 1100,
[2024-01-10T19:50:50.883Z]                  ct.err_msg: f"metric type not match: invalid parameter[expected=IP][actual={metric_type}]"}
[2024-01-10T19:50:50.883Z] >       client_w.search(client, collection_name, vectors_to_search, limit=default_limit,
[2024-01-10T19:50:50.883Z]                         search_params=search_params,
[2024-01-10T19:50:50.883Z]                         check_task=CheckTasks.err_res, check_items=error)
[2024-01-10T19:50:50.883Z] 
[2024-01-10T19:50:50.883Z] testcases/test_high_level_api.py:149: 
[2024-01-10T19:50:50.883Z] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[2024-01-10T19:50:50.883Z] utils/wrapper.py:33: in inner_wrapper
[2024-01-10T19:50:50.883Z]     res, result = func(*args, **kwargs)
[2024-01-10T19:50:50.883Z] base/high_level_api_wrapper.py:62: in search
[2024-01-10T19:50:50.883Z]     check_result = ResponseChecker(res, func_name, check_task, check_items, check,
[2024-01-10T19:50:50.883Z] check/func_check.py:38: in run
[2024-01-10T19:50:50.883Z]     result = self.assert_exception(self.response, self.succ, self.check_items)
[2024-01-10T19:50:50.883Z] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[2024-01-10T19:50:50.883Z] 
[2024-01-10T19:50:50.883Z] res = [[]], actual = True
[2024-01-10T19:50:50.883Z] error_dict = {'err_code': 1100, 'err_msg': 'metric type not match: invalid parameter[expected=IP][actual=L2]'}
[2024-01-10T19:50:50.883Z] 
[2024-01-10T19:50:50.883Z]     @staticmethod
[2024-01-10T19:50:50.883Z]     def assert_exception(res, actual=True, error_dict=None):
[2024-01-10T19:50:50.883Z] >       assert actual is False
[2024-01-10T19:50:50.883Z] E       AssertionError
[2024-01-10T19:50:50.883Z] 
[2024-01-10T19:50:50.883Z] check/func_check.py:114: AssertionError
[2024-01-10T19:50:50.883Z] ------------------------------ Captured log setup ------------------------------
[2024-01-10T19:50:50.883Z] [2024-01-10 18:19:06 - INFO - ci_test]: [setup_class] Start setup class... (client_base.py:38)
[2024-01-10T19:50:50.883Z] [2024-01-10 18:19:06 - INFO - ci_test]: *********************************** setup *********************************** (client_base.py:44)
[2024-01-10T19:50:50.883Z] [2024-01-10 18:19:06 - INFO - ci_test]: [setup_method] Start setup test case test_high_level_search_not_consistent_metric_type. (client_base.py:45)
[2024-01-10T19:50:50.883Z] ------------------------------ Captured log call -------------------------------
[2024-01-10T19:50:50.883Z] [2024-01-10 18:19:06 - DEBUG - ci_test]: (api_request)  : [MilvusClient] args: [], kwargs: {'uri': 'http://mdk-614-n-milvus.milvus-ci:19530', 'token': ''} (api_request.py:62)
[2024-01-10T19:50:50.883Z] [2024-01-10 18:19:06 - DEBUG - pymilvus.milvus_client.milvus_client]: tqdm not found (milvus_client.py:56)
[2024-01-10T19:50:50.883Z] [2024-01-10 18:19:06 - DEBUG - pymilvus.milvus_client.milvus_client]: Created new connection using: df1f6e8a0cf34e76b9cffbc4bf898f79 (milvus_client.py:553)
[2024-01-10T19:50:50.883Z] [2024-01-10 18:19:06 - DEBUG - ci_test]: (api_response) : <pymilvus.milvus_client.milvus_client.MilvusClient object at 0x7f7ed40770d0>  (api_request.py:37)
[2024-01-10T19:50:50.883Z] [2024-01-10 18:19:06 - DEBUG - ci_test]: (api_request)  : [MilvusClient.create_collection] args: ['high_level_api_0Ia0tMPo', 128], kwargs: {'timeout': 120} (api_request.py:62)
[2024-01-10T19:50:50.883Z] [2024-01-10 18:19:06 - DEBUG - pymilvus.milvus_client.milvus_client]: Successfully created collection: high_level_api_0Ia0tMPo (milvus_client.py:102)
[2024-01-10T19:50:50.883Z] [2024-01-10 18:19:07 - DEBUG - pymilvus.milvus_client.milvus_client]: Successfully created an index on collection: high_level_api_0Ia0tMPo (milvus_client.py:121)
[2024-01-10T19:50:50.883Z] [2024-01-10 18:19:09 - DEBUG - ci_test]: (api_response) : None  (api_request.py:37)
[2024-01-10T19:50:50.883Z] [2024-01-10 18:19:09 - DEBUG - ci_test]: (api_request)  : [MilvusClient.search] args: ['high_level_api_0Ia0tMPo', array([[0.6378742 , 0.43925104, 0.13211584, 0.46866668, 0.74429647,
[2024-01-10T19:50:50.883Z]         0.03190612, 0.31691246, 0.60253741]]), None, 10, None, {'metric_type': 'L2'}], kwargs: {'timeout': 120} (api_request.py:62)
[2024-01-10T19:50:50.883Z] [2024-01-10 18:19:09 - DEBUG - ci_test]: (api_response) : [[]]  (api_request.py:37)

Before this, it will raise exception metric type not match: invalid parameter[expected=IP][actual={metric_type}]

Expected Behavior

report error

Steps To Reproduce

No response

Milvus Log

  1. https://jenkins.milvus.io:18080/blue/organizations/jenkins/Milvus%20Nightly%20CI/detail/master/614/pipeline/205/
  2. artifacts-milvus-distributed-kafka-nightly-614-pymilvus-e2e-logs.tar.gz
  3. case: test_high_level_search_not_consistent_metric_type

Anything else?

No response

NicoYuan1986 avatar Jan 11 '24 06:01 NicoYuan1986

/assign @czs007 /unassign

yanliang567 avatar Jan 12 '24 01:01 yanliang567

keep reproducing

NicoYuan1986 avatar Jan 17 '24 02:01 NicoYuan1986

Same on milvus client

NicoYuan1986 avatar Feb 06 '24 03:02 NicoYuan1986

/assign @czs007

xiaofan-luan avatar Feb 06 '24 03:02 xiaofan-luan

fixed in version 2.3.10

czs007 avatar Mar 05 '24 07:03 czs007

@NicoYuan1986 please help to verify on master and 2.3.11

yanliang567 avatar Mar 05 '24 09:03 yanliang567

none fixed. master: master-20240308-7e17f24d 2.4.0rc49

2.3: v2.3.11 2.4.0rc49

/assign @czs007

NicoYuan1986 avatar Mar 11 '24 07:03 NicoYuan1986

keep reproducing on 2.3 branch. https://jenkins.milvus.io:18080/blue/organizations/jenkins/Milvus%20Nightly%20CI/detail/2.3/132/pipeline/146 case: test_high_level_search_not_consistent_metric_type[COSINE] pymilvus==2.3.7rc7

please help fix it.

NicoYuan1986 avatar Mar 14 '24 02:03 NicoYuan1986

@czs007 Now, when index metric type is IP, search with metric L2 will report error as expected, while search with metric type COSINE will not report error. please fix it soon and sync to all branches.

version: 2.3.8rc4

NicoYuan1986 avatar Mar 22 '24 06:03 NicoYuan1986

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Rotten issues close after 30d of inactivity. Reopen the issue with /reopen.

stale[bot] avatar Jun 10 '24 06:06 stale[bot]