mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-29 15:05:31 +08:00
* General proto api for NNS libraries Signed-off-by: groot <yihua.mo@zilliz.com> * refactor confadapter Signed-off-by: Nicky <nicky.xj.lin@gmail.com> * fix unittest failures Signed-off-by: groot <yihua.mo@zilliz.com> * update test_add Signed-off-by: zhenwu <zw@zilliz.com> * update knowhere Signed-off-by: Nicky <nicky.xj.lin@gmail.com> * update test cases Signed-off-by: Xiaohai Xu <xiaohaix@student.unimelb.edu.au> * Update cases * C++ sdk for json parameters Signed-off-by: groot <yihua.mo@zilliz.com> * update unittest Signed-off-by: Nicky <nicky.xj.lin@gmail.com> * fix unittest failures Signed-off-by: groot <yihua.mo@zilliz.com> * fix case Signed-off-by: del-zhenwu <zw@zilliz.com> * modify test_index.py Signed-off-by: shengjh <jianghong.sheng@zilliz.com> * update Signed-off-by: Nicky <nicky.xj.lin@gmail.com> * update sptag Signed-off-by: Nicky <nicky.xj.lin@gmail.com> * update... Signed-off-by: Nicky <nicky.xj.lin@gmail.com> * Build Pass Signed-off-by: xiaojun.lin <xiaojun.lin@zilliz.com> * knowhere/wrapper ut pass Signed-off-by: xiaojun.lin <xiaojun.lin@zilliz.com> * update util Signed-off-by: Xiaohai Xu <xiaohaix@student.unimelb.edu.au> * fix wal case Signed-off-by: del-zhenwu <zw@zilliz.com> * modify test_search_vectors Signed-off-by: shengjh <jianghong.sheng@zilliz.com> * update ci Signed-off-by: del-zhenwu <zw@zilliz.com> * update util Signed-off-by: Xiaohai Xu <xiaohaix@student.unimelb.edu.au> * modify test_search_vectoes Signed-off-by: shengjh <jianghong.sheng@zilliz.com> * add hnsw in http module & modify index apis Signed-off-by: Yhz <yinghao.zou@zilliz.com> * modify search in http module Signed-off-by: Yhz <yinghao.zou@zilliz.com> * fix build error Signed-off-by: groot <yihua.mo@zilliz.com> * fix typo in test_index and test_search Signed-off-by: shengjh <jianghong.sheng@zilliz.com> * update... Signed-off-by: Nicky <nicky.xj.lin@gmail.com> * index apis in http module done Signed-off-by: Yhz <yinghao.zou@zilliz.com> * fix build index bug Signed-off-by: groot <yihua.mo@zilliz.com> * search apis unittest pass Signed-off-by: Yhz <yinghao.zou@zilliz.com> * web test pass Signed-off-by: Yhz <yinghao.zou@zilliz.com> * update confadapter Signed-off-by: Nicky <nicky.xj.lin@gmail.com> * update util Signed-off-by: Xiaohai Xu <xiaohaix@student.unimelb.edu.au> * code format Signed-off-by: groot <yihua.mo@zilliz.com> * code format Signed-off-by: groot <yihua.mo@zilliz.com> * fix vectors results bug (fix #1476) Signed-off-by: Yhz <yinghao.zou@zilliz.com> * clang format Signed-off-by: Yhz <yinghao.zou@zilliz.com> * update test Signed-off-by: shengjh <jianghong.sheng@zilliz.com> * fix unittest Signed-off-by: groot <yihua.mo@zilliz.com> * add test_config Signed-off-by: Xiaohai Xu <xiaohaix@student.unimelb.edu.au> * add log Signed-off-by: groot <yihua.mo@zilliz.com> * fix a build error Signed-off-by: groot <yihua.mo@zilliz.com> * add invalid param search test Signed-off-by: shengjh <jianghong.sheng@zilliz.com> * fix range check Signed-off-by: Nicky <nicky.xj.lin@gmail.com> * cpmpact/flush case passed Signed-off-by: del-zhenwu <zhenxiang.li@zilliz.com> * fix unittest failures Signed-off-by: groot <yihua.mo@zilliz.com> * fix unittest failures Signed-off-by: groot <yihua.mo@zilliz.com> * fix unittest failures Signed-off-by: groot <yihua.mo@zilliz.com> * validate json parameters in request Signed-off-by: groot <yihua.mo@zilliz.com> * add unittest cases Signed-off-by: groot <yihua.mo@zilliz.com> * update test index/search Signed-off-by: shengjh <jianghong.sheng@zilliz.com> * update test_config Signed-off-by: sahuang <xiaohaix@student.unimelb.edu.au> * fix Signed-off-by: shengjh <jianghong.sheng@zilliz.com> * support nsg and ivf-nlist Signed-off-by: Nicky <nicky.xj.lin@gmail.com> * update Signed-off-by: xiaojun.lin <xiaojun.lin@zilliz.com> * fix validation bug Signed-off-by: groot <yihua.mo@zilliz.com> * fix python test bug Signed-off-by: groot <yihua.mo@zilliz.com> * fix python test bug Signed-off-by: groot <yihua.mo@zilliz.com> * fix python test bug Signed-off-by: groot <yihua.mo@zilliz.com> * fix python test bug Signed-off-by: groot <yihua.mo@zilliz.com> * code format Signed-off-by: groot <yihua.mo@zilliz.com> * fix python test failure Signed-off-by: groot <yihua.mo@zilliz.com> * remove rnsg cases Signed-off-by: zhenwu <zw@zilliz.com> * fix python test failure Signed-off-by: groot <yihua.mo@zilliz.com> * Update changelog Signed-off-by: JinHai-CN <hai.jin@zilliz.com> * Fix typo Signed-off-by: JinHai-CN <hai.jin@zilliz.com> * add pq to test_index && multithread test Signed-off-by: shengjh <jianghong.sheng@zilliz.com> * add pq to test_search Signed-off-by: shengjh <jianghong.sheng@zilliz.com> * Fix format Signed-off-by: JinHai-CN <hai.jin@zilliz.com> * Update CHANGELOG Signed-off-by: JinHai-CN <hai.jin@zilliz.com> * Fix compiling error Signed-off-by: JinHai-CN <hai.jin@zilliz.com> * Fix compiling error Signed-off-by: JinHai-CN <hai.jin@zilliz.com> * fix config bug Signed-off-by: groot <yihua.mo@zilliz.com> * code format Signed-off-by: groot <yihua.mo@zilliz.com> * fix config test Signed-off-by: xiaojun.lin <xiaojun.lin@zilliz.com> * Update CHANGELOG.md Signed-off-by: JinHai-CN <hai.jin@zilliz.com> * Update CHANGELOG.md Signed-off-by: JinHai-CN <hai.jin@zilliz.com> * disable config test case Signed-off-by: zhenwu <zw@zilliz.com> Co-authored-by: Nicky <nicky.xj.lin@gmail.com> Co-authored-by: zhenwu <zw@zilliz.com> Co-authored-by: Xiaohai Xu <xiaohaix@student.unimelb.edu.au> Co-authored-by: shengjh <jianghong.sheng@zilliz.com> Co-authored-by: xiaojun.lin <xiaojun.lin@zilliz.com> Co-authored-by: Yhz <yinghao.zou@zilliz.com> Co-authored-by: del-zhenwu <zhenxiang.li@zilliz.com> Co-authored-by: JinHai-CN <hai.jin@zilliz.com>
130 lines
4.6 KiB
Python
130 lines
4.6 KiB
Python
import time
|
|
import pdb
|
|
import threading
|
|
import logging
|
|
from multiprocessing import Pool, Process
|
|
import pytest
|
|
from milvus import IndexType, MetricType
|
|
from utils import *
|
|
|
|
dim = 128
|
|
table_id = "test_wal"
|
|
WAL_TIMEOUT = 30
|
|
nb = 6000
|
|
add_interval = 1.5
|
|
|
|
|
|
class TestWalBase:
|
|
"""
|
|
******************************************************************
|
|
The following cases are used to test WAL functionality
|
|
******************************************************************
|
|
"""
|
|
@pytest.mark.timeout(WAL_TIMEOUT)
|
|
def test_wal_add_vectors(self, connect, table):
|
|
'''
|
|
target: add vectors in WAL
|
|
method: add vectors and flush when WAL is enabled
|
|
expected: status ok, vectors added
|
|
'''
|
|
vectors = gen_vector(nb, dim)
|
|
status, ids = connect.add_vectors(table, vectors)
|
|
assert status.OK()
|
|
status = connect.flush([table])
|
|
assert status.OK()
|
|
status, res = connect.get_table_row_count(table)
|
|
assert status.OK()
|
|
assert res == nb
|
|
status, res = connect.get_vector_by_id(table, ids[0])
|
|
logging.getLogger().info(res)
|
|
assert status.OK()
|
|
assert_equal_vector(res, vectors[0])
|
|
|
|
@pytest.mark.timeout(WAL_TIMEOUT)
|
|
def test_wal_delete_vectors(self, connect, table):
|
|
'''
|
|
target: delete vectors in WAL
|
|
method: delete vectors and flush when WAL is enabled
|
|
expected: status ok, vectors deleted
|
|
'''
|
|
vectors = gen_vector(nb, dim)
|
|
status, ids = connect.add_vectors(table, vectors)
|
|
assert status.OK()
|
|
connect.flush([table])
|
|
status, res = connect.get_table_row_count(table)
|
|
assert status.OK()
|
|
status = connect.delete_by_id(table, ids)
|
|
assert status.OK()
|
|
status = connect.flush([table])
|
|
assert status.OK()
|
|
status, res = connect.get_table_row_count(table)
|
|
assert status.OK()
|
|
assert res == 0
|
|
|
|
@pytest.mark.timeout(WAL_TIMEOUT)
|
|
def test_wal_invalid_operation(self, connect, table):
|
|
'''
|
|
target: invalid operation in WAL
|
|
method: add vectors, delete with non-existent ids and flush when WAL is enabled
|
|
expected: status ok, search with vector have result
|
|
'''
|
|
vector = gen_single_vector(dim)
|
|
status, ids = connect.add_vectors(table, vector)
|
|
assert status.OK()
|
|
connect.flush([table])
|
|
status = connect.delete_by_id(table, [0])
|
|
assert status.OK()
|
|
status = connect.flush([table])
|
|
status, res = connect.get_table_row_count(table)
|
|
assert status.OK()
|
|
assert res == 1
|
|
|
|
@pytest.mark.timeout(WAL_TIMEOUT)
|
|
def test_wal_invalid_operation_B(self, connect, table):
|
|
'''
|
|
target: invalid operation in WAL
|
|
method: add vectors, delete with not existed table name when WAL is enabled
|
|
expected: status not ok
|
|
'''
|
|
vectors = gen_vector(nb, dim)
|
|
status, ids = connect.add_vectors(table, vectors)
|
|
assert status.OK()
|
|
status = connect.flush([table])
|
|
status = connect.delete_by_id(table, [0])
|
|
connect.flush([table])
|
|
table_new = gen_unique_str()
|
|
status = connect.delete_by_id(table_new, ids)
|
|
assert not status.OK()
|
|
status = connect.flush([table])
|
|
assert status.OK()
|
|
status, res = connect.get_table_row_count(table)
|
|
assert status.OK()
|
|
assert res == nb
|
|
|
|
@pytest.mark.timeout(WAL_TIMEOUT)
|
|
def test_wal_server_crashed_recovery(self, connect, table):
|
|
'''
|
|
target: test wal when server crashed unexpectedly and restarted
|
|
method: add vectors, server killed before flush, restarted server and flush
|
|
expected: status ok, add request is recovered and vectors added
|
|
'''
|
|
vector = gen_single_vector(dim)
|
|
status, ids = connect.add_vectors(table, vector)
|
|
assert status.OK()
|
|
status = connect.flush([table])
|
|
status, res = connect.get_table_row_count(table)
|
|
assert status.OK()
|
|
logging.getLogger().info(res) # should be 0 because no auto flush
|
|
logging.getLogger().info("Stop server and restart")
|
|
# kill server and restart. auto flush should be set to 15 seconds.
|
|
# time.sleep(15)
|
|
status = connect.flush([table])
|
|
assert status.OK()
|
|
status, res = connect.get_table_row_count(table)
|
|
assert status.OK()
|
|
assert res == 1
|
|
status, res = connect.get_vector_by_id(table, ids[0])
|
|
logging.getLogger().info(res)
|
|
assert status.OK()
|
|
assert_equal_vector(res, vector[0])
|