Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
9b20d700
M
milvus
项目概览
milvus
/
milvus
12 个月 前同步成功
通知
261
Star
22476
Fork
2472
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
9b20d700
编写于
10月 21, 2021
作者:
T
ThreadDao
提交者:
GitHub
10月 21, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[skip ci] Add some L2 delete cases (#10361)
Signed-off-by:
N
ThreadDao
<
yufen.zong@zilliz.com
>
上级
a287bcf4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
107 addition
and
10 deletion
+107
-10
tests/python_client/testcases/test_delete_20.py
tests/python_client/testcases/test_delete_20.py
+107
-10
未找到文件。
tests/python_client/testcases/test_delete_20.py
浏览文件 @
9b20d700
...
@@ -36,8 +36,13 @@ class TestDeleteParams(TestcaseBase):
...
@@ -36,8 +36,13 @@ class TestDeleteParams(TestcaseBase):
expr
=
f
'
{
ct
.
default_int64_field_name
}
in
{
ids
[:
half_nb
]
}
'
expr
=
f
'
{
ct
.
default_int64_field_name
}
in
{
ids
[:
half_nb
]
}
'
# delete half of data
# delete half of data
collection_w
.
delete
(
expr
)
del_res
=
collection_w
.
delete
(
expr
)[
0
]
assert
collection_w
.
num_entities
==
half_nb
assert
del_res
.
delete_count
==
half_nb
collection_w
.
num_entities
# query with deleted ids
query_res
=
collection_w
.
query
(
expr
)[
0
]
assert
len
(
query_res
)
==
0
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
def
test_delete_without_connection
(
self
):
def
test_delete_without_connection
(
self
):
...
@@ -517,6 +522,25 @@ class TestDeleteOperation(TestcaseBase):
...
@@ -517,6 +522,25 @@ class TestDeleteOperation(TestcaseBase):
query_res
,
_
=
collection_w
.
query
(
expr
)
query_res
,
_
=
collection_w
.
query
(
expr
)
assert
len
(
query_res
)
==
0
assert
len
(
query_res
)
==
0
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_delete_query_without_loading
(
self
):
"""
target: test delete and query without loading
method: 1.insert and flush data
2.delete ids
3.query without loading
expected: Raise exception
"""
# create collection, insert data without flush
collection_w
=
self
.
init_collection_wrap
(
name
=
cf
.
gen_unique_str
(
prefix
))
df
=
cf
.
gen_default_dataframe_data
(
tmp_nb
)
collection_w
.
insert
(
df
)
assert
collection_w
.
num_entities
==
tmp_nb
# query without loading and raise exception
error
=
{
ct
.
err_code
:
1
,
ct
.
err_msg
:
f
"collection
{
collection_w
.
name
}
was not loaded into memory"
}
collection_w
.
delete
(
expr
=
tmp_expr
,
check_task
=
CheckTasks
.
err_res
,
check_items
=
error
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L1
)
def
test_delete_without_flush
(
self
):
def
test_delete_without_flush
(
self
):
"""
"""
...
@@ -524,9 +548,9 @@ class TestDeleteOperation(TestcaseBase):
...
@@ -524,9 +548,9 @@ class TestDeleteOperation(TestcaseBase):
method: 1.insert data and no flush
method: 1.insert data and no flush
2.delete ids from collection
2.delete ids from collection
3.load and query with id
3.load and query with id
expected:
query result is empty
expected:
No query result
"""
"""
#
init collection and
insert data without flush
#
create collection,
insert data without flush
collection_w
=
self
.
init_collection_wrap
(
name
=
cf
.
gen_unique_str
(
prefix
))
collection_w
=
self
.
init_collection_wrap
(
name
=
cf
.
gen_unique_str
(
prefix
))
df
=
cf
.
gen_default_dataframe_data
(
tmp_nb
)
df
=
cf
.
gen_default_dataframe_data
(
tmp_nb
)
collection_w
.
insert
(
df
)
collection_w
.
insert
(
df
)
...
@@ -535,12 +559,85 @@ class TestDeleteOperation(TestcaseBase):
...
@@ -535,12 +559,85 @@ class TestDeleteOperation(TestcaseBase):
del_res
,
_
=
collection_w
.
delete
(
tmp_expr
)
del_res
,
_
=
collection_w
.
delete
(
tmp_expr
)
assert
del_res
.
delete_count
==
1
assert
del_res
.
delete_count
==
1
# query with id
# load and query with id
collection_w
.
load
()
query_res
=
collection_w
.
query
(
tmp_expr
)[
0
]
assert
len
(
query_res
)
==
0
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_delete_data_from_growing_segment
(
self
):
"""
target: test delete entities from growing segment
method: 1.create collection
2.load collection
3.insert data and delete ids
4.query deleted ids
expected: No query result
"""
# create collection
collection_w
=
self
.
init_collection_wrap
(
name
=
cf
.
gen_unique_str
(
prefix
))
# load collection and the queryNode watch the insertChannel
collection_w
.
load
()
# insert data
df
=
cf
.
gen_default_dataframe_data
(
tmp_nb
)
collection_w
.
insert
(
df
)
# delete id 0
del_res
=
collection_w
.
delete
(
tmp_expr
)[
0
]
assert
del_res
.
delete_count
==
1
# query id 0
query_res
=
collection_w
.
query
(
tmp_expr
)[
0
]
assert
len
(
query_res
)
==
0
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_delete_after_load_sealed_segment
(
self
):
"""
target: test delete sealed data and get deleteMsg from insertChannel
method: 1.create, insert and flush data
2.load collection
3.delete id without flush
4.query deleted ids (queryNode get deleted ids from channel not persistence)
expected: Delete successfully and no query result
"""
# create collection and insert flush data
collection_w
=
self
.
init_collection_wrap
(
name
=
cf
.
gen_unique_str
(
prefix
))
df
=
cf
.
gen_default_dataframe_data
(
tmp_nb
)
collection_w
.
insert
(
df
)
assert
collection_w
.
num_entities
==
tmp_nb
# load collection and queryNode subscribe channel
collection_w
.
load
()
# delete ids and query
collection_w
.
delete
(
tmp_expr
)
query_res
=
collection_w
.
query
(
tmp_expr
)[
0
]
assert
len
(
query_res
)
==
0
@
pytest
.
mark
.
tags
(
CaseLabel
.
L2
)
def
test_delete_sealed_segment_with_flush
(
self
):
"""
target: test delete data from sealed segment and flush delta log
method: 1.create and insert and flush data
2.delete entities and flush (delta log persistence)
3.load collection (load data and delta log)
4.query deleted ids
expected: No query result
"""
# create collection
collection_w
=
self
.
init_collection_wrap
(
name
=
cf
.
gen_unique_str
(
prefix
))
# insert and flush data
df
=
cf
.
gen_default_dataframe_data
(
tmp_nb
)
collection_w
.
insert
(
df
)
assert
collection_w
.
num_entities
==
tmp_nb
# delete id 0 and flush
del_res
=
collection_w
.
delete
(
tmp_expr
)[
0
]
assert
del_res
.
delete_count
==
1
collection_w
.
num_entities
# load and query id 0
collection_w
.
load
()
collection_w
.
load
()
query_res
=
collection_w
.
query
(
tmp_expr
)[
0
]
query_res
=
collection_w
.
query
(
tmp_expr
)[
0
]
assert
len
(
query_res
)
==
0
assert
len
(
query_res
)
==
0
@
pytest
.
mark
.
tags
(
CaseLabel
.
L
3
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L
2
)
def
test_delete_insert_same_entity
(
self
):
def
test_delete_insert_same_entity
(
self
):
"""
"""
target: test delete and insert same entity
target: test delete and insert same entity
...
@@ -567,7 +664,7 @@ class TestDeleteOperation(TestcaseBase):
...
@@ -567,7 +664,7 @@ class TestDeleteOperation(TestcaseBase):
res
=
df
.
iloc
[
0
:
1
,
:
1
].
to_dict
(
'records'
)
res
=
df
.
iloc
[
0
:
1
,
:
1
].
to_dict
(
'records'
)
collection_w
.
query
(
tmp_expr
,
check_task
=
CheckTasks
.
check_query_results
,
check_items
=
{
'exp_res'
:
res
})
collection_w
.
query
(
tmp_expr
,
check_task
=
CheckTasks
.
check_query_results
,
check_items
=
{
'exp_res'
:
res
})
@
pytest
.
mark
.
tags
(
CaseLabel
.
L
3
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L
2
)
def
test_delete_entity_loop
(
self
):
def
test_delete_entity_loop
(
self
):
"""
"""
target: test delete all entities one by one in a loop
target: test delete all entities one by one in a loop
...
@@ -591,7 +688,7 @@ class TestDeleteOperation(TestcaseBase):
...
@@ -591,7 +688,7 @@ class TestDeleteOperation(TestcaseBase):
last_res
,
_
=
collection_w
.
query
(
last_expr
)
last_res
,
_
=
collection_w
.
query
(
last_expr
)
assert
len
(
last_res
)
==
0
assert
len
(
last_res
)
==
0
@
pytest
.
mark
.
tags
(
CaseLabel
.
L
3
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L
2
)
def
test_delete_flush_loop
(
self
):
def
test_delete_flush_loop
(
self
):
"""
"""
target: test delete and flush in a loop
target: test delete and flush in a loop
...
@@ -603,7 +700,7 @@ class TestDeleteOperation(TestcaseBase):
...
@@ -603,7 +700,7 @@ class TestDeleteOperation(TestcaseBase):
batch
=
10
batch
=
10
for
i
in
range
(
tmp_nb
//
batch
):
for
i
in
range
(
tmp_nb
//
batch
):
expr
=
f
'
{
ct
.
default_int64_field_name
}
in
{
ids
[
i
*
batch
:
(
i
+
1
)
*
batch
]
}
'
expr
=
f
'
{
ct
.
default_int64_field_name
}
in
{
ids
[
i
*
batch
:
(
i
+
1
)
*
batch
]
}
'
res
,
_
=
collection_w
.
delete
(
expr
)
res
,
_
=
collection_w
.
delete
(
expr
)
assert
res
.
delete_count
==
batch
assert
res
.
delete_count
==
batch
assert
collection_w
.
num_entities
==
tmp_nb
assert
collection_w
.
num_entities
==
tmp_nb
...
@@ -617,7 +714,7 @@ class TestDeleteOperation(TestcaseBase):
...
@@ -617,7 +714,7 @@ class TestDeleteOperation(TestcaseBase):
last_res
,
_
=
collection_w
.
query
(
last_expr
)
last_res
,
_
=
collection_w
.
query
(
last_expr
)
assert
len
(
last_res
)
==
0
assert
len
(
last_res
)
==
0
@
pytest
.
mark
.
tags
(
CaseLabel
.
L
3
)
@
pytest
.
mark
.
tags
(
CaseLabel
.
L
2
)
@
pytest
.
mark
.
skip
(
reason
=
"TODO"
)
@
pytest
.
mark
.
skip
(
reason
=
"TODO"
)
def
test_delete_multi_threading
(
self
):
def
test_delete_multi_threading
(
self
):
"""
"""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录