Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
5f3b9615
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,发现更多精彩内容 >>
未验证
提交
5f3b9615
编写于
9月 15, 2021
作者:
D
dragondriver
提交者:
GitHub
9月 15, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add test case for delete task (#7939)
Signed-off-by:
N
dragondriver
<
jiquan.long@zilliz.com
>
上级
a0fd2707
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
122 addition
and
23 deletion
+122
-23
internal/proxy/impl.go
internal/proxy/impl.go
+2
-2
internal/proxy/metrics_info.go
internal/proxy/metrics_info.go
+1
-2
internal/proxy/metrics_info_test.go
internal/proxy/metrics_info_test.go
+5
-4
internal/proxy/task.go
internal/proxy/task.go
+16
-15
internal/proxy/task_test.go
internal/proxy/task_test.go
+98
-0
未找到文件。
internal/proxy/impl.go
浏览文件 @
5f3b9615
...
...
@@ -1355,7 +1355,7 @@ func (node *Proxy) Delete(ctx context.Context, request *milvuspb.DeleteRequest)
},
nil
}
dt
:=
&
D
eleteTask
{
dt
:=
&
d
eleteTask
{
ctx
:
ctx
,
Condition
:
NewTaskCondition
(
ctx
),
DeleteRequest
:
request
,
...
...
@@ -2210,7 +2210,7 @@ func (node *Proxy) GetMetrics(ctx context.Context, req *milvuspb.GetMetricsReque
log
.
Debug
(
"failed to get system info metrics from cache, recompute instead"
,
zap
.
Error
(
err
))
metrics
,
err
:=
getSystemInfoMetrics
(
ctx
,
req
,
node
,
node
.
session
.
Address
)
metrics
,
err
:=
getSystemInfoMetrics
(
ctx
,
req
,
node
)
log
.
Debug
(
"Proxy.GetMetrics"
,
zap
.
Int64
(
"node_id"
,
Params
.
ProxyID
),
...
...
internal/proxy/metrics_info.go
浏览文件 @
5f3b9615
...
...
@@ -32,7 +32,6 @@ func getSystemInfoMetrics(
ctx
context
.
Context
,
request
*
milvuspb
.
GetMetricsRequest
,
node
*
Proxy
,
ip
string
,
)
(
*
milvuspb
.
GetMetricsResponse
,
error
)
{
var
err
error
...
...
@@ -54,7 +53,7 @@ func getSystemInfoMetrics(
ErrorReason
:
""
,
Name
:
proxyRoleName
,
HardwareInfos
:
metricsinfo
.
HardwareMetrics
{
IP
:
ip
,
IP
:
node
.
session
.
Address
,
CPUCoreCount
:
metricsinfo
.
GetCPUCoreCount
(
false
),
CPUCoreUsage
:
metricsinfo
.
GetCPUUsage
(),
Memory
:
metricsinfo
.
GetMemoryCount
(),
...
...
internal/proxy/metrics_info_test.go
浏览文件 @
5f3b9615
...
...
@@ -15,6 +15,9 @@ import (
"context"
"testing"
"github.com/milvus-io/milvus/internal/util/funcutil"
"github.com/milvus-io/milvus/internal/util/sessionutil"
"github.com/milvus-io/milvus/internal/util/uniquegenerator"
"github.com/milvus-io/milvus/internal/proto/commonpb"
...
...
@@ -24,8 +27,6 @@ import (
"github.com/stretchr/testify/assert"
"github.com/milvus-io/milvus/internal/util/metricsinfo"
"github.com/milvus-io/milvus/internal/util/funcutil"
)
func
TestProxy_metrics
(
t
*
testing
.
T
)
{
...
...
@@ -54,6 +55,7 @@ func TestProxy_metrics(t *testing.T) {
queryCoord
:
qc
,
dataCoord
:
dc
,
indexCoord
:
ic
,
session
:
&
sessionutil
.
Session
{
Address
:
funcutil
.
GenRandomStr
()},
}
rc
.
getMetricsFunc
=
func
(
ctx
context
.
Context
,
request
*
milvuspb
.
GetMetricsRequest
)
(
*
milvuspb
.
GetMetricsResponse
,
error
)
{
...
...
@@ -267,9 +269,8 @@ func TestProxy_metrics(t *testing.T) {
}
ip
:=
funcutil
.
GenRandomStr
()
req
,
_
:=
metricsinfo
.
ConstructRequestByMetricType
(
metricsinfo
.
SystemInfoMetrics
)
resp
,
err
:=
getSystemInfoMetrics
(
ctx
,
req
,
proxy
,
ip
)
resp
,
err
:=
getSystemInfoMetrics
(
ctx
,
req
,
proxy
)
assert
.
NoError
(
t
,
err
)
assert
.
NotNil
(
t
,
resp
)
...
...
internal/proxy/task.go
浏览文件 @
5f3b9615
...
...
@@ -79,6 +79,7 @@ const (
ReleaseCollectionTaskName
=
"ReleaseCollectionTask"
LoadPartitionTaskName
=
"LoadPartitionsTask"
ReleasePartitionTaskName
=
"ReleasePartitionsTask"
deleteTaskName
=
"DeleteTask"
)
type
task
interface
{
...
...
@@ -4620,52 +4621,52 @@ func (rpt *releasePartitionsTask) PostExecute(ctx context.Context) error {
return
nil
}
type
D
eleteTask
struct
{
type
d
eleteTask
struct
{
Condition
*
milvuspb
.
DeleteRequest
ctx
context
.
Context
result
*
milvuspb
.
MutationResult
}
func
(
dt
*
D
eleteTask
)
TraceCtx
()
context
.
Context
{
func
(
dt
*
d
eleteTask
)
TraceCtx
()
context
.
Context
{
return
dt
.
ctx
}
func
(
dt
*
D
eleteTask
)
ID
()
UniqueID
{
func
(
dt
*
d
eleteTask
)
ID
()
UniqueID
{
return
dt
.
Base
.
MsgID
}
func
(
dt
*
D
eleteTask
)
SetID
(
uid
UniqueID
)
{
func
(
dt
*
d
eleteTask
)
SetID
(
uid
UniqueID
)
{
dt
.
Base
.
MsgID
=
uid
}
func
(
dt
*
D
eleteTask
)
Type
()
commonpb
.
MsgType
{
func
(
dt
*
d
eleteTask
)
Type
()
commonpb
.
MsgType
{
return
dt
.
Base
.
MsgType
}
func
(
dt
*
D
eleteTask
)
Name
()
string
{
return
ReleasePartition
TaskName
func
(
dt
*
d
eleteTask
)
Name
()
string
{
return
delete
TaskName
}
func
(
dt
*
D
eleteTask
)
BeginTs
()
Timestamp
{
func
(
dt
*
d
eleteTask
)
BeginTs
()
Timestamp
{
return
dt
.
Base
.
Timestamp
}
func
(
dt
*
D
eleteTask
)
EndTs
()
Timestamp
{
func
(
dt
*
d
eleteTask
)
EndTs
()
Timestamp
{
return
dt
.
Base
.
Timestamp
}
func
(
dt
*
D
eleteTask
)
SetTs
(
ts
Timestamp
)
{
func
(
dt
*
d
eleteTask
)
SetTs
(
ts
Timestamp
)
{
dt
.
Base
.
Timestamp
=
ts
}
func
(
dt
*
D
eleteTask
)
OnEnqueue
()
error
{
func
(
dt
*
d
eleteTask
)
OnEnqueue
()
error
{
dt
.
Base
=
&
commonpb
.
MsgBase
{}
return
nil
}
func
(
dt
*
D
eleteTask
)
PreExecute
(
ctx
context
.
Context
)
error
{
dt
.
Base
.
MsgType
=
commonpb
.
MsgType_
ReleasePartitions
func
(
dt
*
d
eleteTask
)
PreExecute
(
ctx
context
.
Context
)
error
{
dt
.
Base
.
MsgType
=
commonpb
.
MsgType_
Delete
dt
.
Base
.
SourceID
=
Params
.
ProxyID
collName
:=
dt
.
CollectionName
...
...
@@ -4681,10 +4682,10 @@ func (dt *DeleteTask) PreExecute(ctx context.Context) error {
return
nil
}
func
(
dt
*
D
eleteTask
)
Execute
(
ctx
context
.
Context
)
(
err
error
)
{
func
(
dt
*
d
eleteTask
)
Execute
(
ctx
context
.
Context
)
(
err
error
)
{
return
nil
}
func
(
dt
*
D
eleteTask
)
PostExecute
(
ctx
context
.
Context
)
error
{
func
(
dt
*
d
eleteTask
)
PostExecute
(
ctx
context
.
Context
)
error
{
return
nil
}
internal/proxy/task_test.go
浏览文件 @
5f3b9615
...
...
@@ -2979,3 +2979,101 @@ func TestInsertTask_all(t *testing.T) {
assert
.
NoError
(
t
,
task
.
Execute
(
ctx
))
assert
.
NoError
(
t
,
task
.
PostExecute
(
ctx
))
}
func
TestDeleteTask_all
(
t
*
testing
.
T
)
{
Params
.
Init
()
ctx
:=
context
.
Background
()
prefix
:=
"TestDeleteTask_all"
dbName
:=
""
collectionName
:=
prefix
+
funcutil
.
GenRandomStr
()
partitionName
:=
prefix
+
funcutil
.
GenRandomStr
()
task
:=
&
deleteTask
{
Condition
:
NewTaskCondition
(
ctx
),
DeleteRequest
:
&
milvuspb
.
DeleteRequest
{
Base
:
&
commonpb
.
MsgBase
{
MsgType
:
commonpb
.
MsgType_Delete
,
MsgID
:
0
,
Timestamp
:
0
,
SourceID
:
0
,
},
DbName
:
dbName
,
CollectionName
:
collectionName
,
PartitionName
:
partitionName
,
Expr
:
""
,
},
ctx
:
ctx
,
result
:
&
milvuspb
.
MutationResult
{
Status
:
&
commonpb
.
Status
{
ErrorCode
:
commonpb
.
ErrorCode_Success
,
Reason
:
""
,
},
IDs
:
nil
,
SuccIndex
:
nil
,
ErrIndex
:
nil
,
Acknowledged
:
false
,
InsertCnt
:
0
,
DeleteCnt
:
0
,
UpsertCnt
:
0
,
Timestamp
:
0
,
},
}
assert
.
NoError
(
t
,
task
.
OnEnqueue
())
assert
.
NotNil
(
t
,
task
.
TraceCtx
())
id
:=
UniqueID
(
uniquegenerator
.
GetUniqueIntGeneratorIns
()
.
GetInt
())
task
.
SetID
(
id
)
assert
.
Equal
(
t
,
id
,
task
.
ID
())
task
.
Base
.
MsgType
=
commonpb
.
MsgType_Delete
assert
.
Equal
(
t
,
commonpb
.
MsgType_Delete
,
task
.
Type
())
ts
:=
Timestamp
(
time
.
Now
()
.
UnixNano
())
task
.
SetTs
(
ts
)
assert
.
Equal
(
t
,
ts
,
task
.
BeginTs
())
assert
.
Equal
(
t
,
ts
,
task
.
EndTs
())
assert
.
NoError
(
t
,
task
.
PreExecute
(
ctx
))
assert
.
NoError
(
t
,
task
.
Execute
(
ctx
))
assert
.
NoError
(
t
,
task
.
PostExecute
(
ctx
))
}
func
TestDeleteTask_PreExecute
(
t
*
testing
.
T
)
{
Params
.
Init
()
ctx
:=
context
.
Background
()
prefix
:=
"TestDeleteTask_all"
dbName
:=
""
collectionName
:=
prefix
+
funcutil
.
GenRandomStr
()
partitionName
:=
prefix
+
funcutil
.
GenRandomStr
()
task
:=
&
deleteTask
{
DeleteRequest
:
&
milvuspb
.
DeleteRequest
{
Base
:
&
commonpb
.
MsgBase
{
MsgType
:
commonpb
.
MsgType_Delete
,
MsgID
:
0
,
Timestamp
:
0
,
SourceID
:
0
,
},
DbName
:
dbName
,
CollectionName
:
collectionName
,
PartitionName
:
partitionName
,
Expr
:
""
,
},
}
assert
.
NoError
(
t
,
task
.
PreExecute
(
ctx
))
task
.
DeleteRequest
.
CollectionName
=
""
// empty
assert
.
Error
(
t
,
task
.
PreExecute
(
ctx
))
task
.
DeleteRequest
.
CollectionName
=
collectionName
task
.
DeleteRequest
.
PartitionName
=
""
// empty
assert
.
Error
(
t
,
task
.
PreExecute
(
ctx
))
task
.
DeleteRequest
.
PartitionName
=
partitionName
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录