Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
51404abe
M
milvus
项目概览
milvus
/
milvus
9 个月 前同步成功
通知
260
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
51404abe
编写于
6月 14, 2023
作者:
G
Gao
提交者:
GitHub
6月 14, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add missing indexInfo in watchDmChannelsRequest (#24696)
Signed-off-by:
N
chasingegg
<
chao.gao@zilliz.com
>
上级
f60b8391
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
47 deletion
+30
-47
internal/querycoordv2/task/executor.go
internal/querycoordv2/task/executor.go
+7
-2
internal/querycoordv2/task/utils.go
internal/querycoordv2/task/utils.go
+10
-12
internal/querycoordv2/task/utils_test.go
internal/querycoordv2/task/utils_test.go
+13
-33
未找到文件。
internal/querycoordv2/task/executor.go
浏览文件 @
51404abe
...
...
@@ -396,7 +396,12 @@ func (ex *Executor) subDmChannel(task *ChannelTask, step int) error {
log
.
Warn
(
"failed to get partitions of collection"
)
return
err
}
metricType
,
err
:=
getMetricType
(
ctx
,
task
.
CollectionID
(),
schema
,
ex
.
broker
)
indexInfo
,
err
:=
ex
.
broker
.
DescribeIndex
(
ctx
,
task
.
CollectionID
())
if
err
!=
nil
{
log
.
Warn
(
"fail to get index meta of collection"
)
return
err
}
metricType
,
err
:=
getMetricType
(
indexInfo
,
schema
)
if
err
!=
nil
{
log
.
Warn
(
"failed to get metric type"
,
zap
.
Error
(
err
))
return
err
...
...
@@ -414,7 +419,7 @@ func (ex *Executor) subDmChannel(task *ChannelTask, step int) error {
log
.
Warn
(
msg
,
zap
.
String
(
"channelName"
,
action
.
ChannelName
()))
return
merr
.
WrapErrChannelReduplicate
(
action
.
ChannelName
())
}
req
:=
packSubChannelRequest
(
task
,
action
,
schema
,
loadMeta
,
dmChannel
)
req
:=
packSubChannelRequest
(
task
,
action
,
schema
,
loadMeta
,
dmChannel
,
indexInfo
)
err
=
fillSubChannelRequest
(
ctx
,
req
,
ex
.
broker
)
if
err
!=
nil
{
log
.
Warn
(
"failed to subscribe channel, failed to fill the request with segments"
,
...
...
internal/querycoordv2/task/utils.go
浏览文件 @
51404abe
...
...
@@ -138,19 +138,21 @@ func packSubChannelRequest(
schema
*
schemapb
.
CollectionSchema
,
loadMeta
*
querypb
.
LoadMetaInfo
,
channel
*
meta
.
DmChannel
,
indexInfo
[]
*
indexpb
.
IndexInfo
,
)
*
querypb
.
WatchDmChannelsRequest
{
return
&
querypb
.
WatchDmChannelsRequest
{
Base
:
commonpbutil
.
NewMsgBase
(
commonpbutil
.
WithMsgType
(
commonpb
.
MsgType_WatchDmChannels
),
commonpbutil
.
WithMsgID
(
task
.
ID
()),
),
NodeID
:
action
.
Node
(),
CollectionID
:
task
.
CollectionID
(),
Infos
:
[]
*
datapb
.
VchannelInfo
{
channel
.
VchannelInfo
},
Schema
:
schema
,
// assign it for compatibility of rolling upgrade from 2.2.x to 2.3
LoadMeta
:
loadMeta
,
// assign it for compatibility of rolling upgrade from 2.2.x to 2.3
ReplicaID
:
task
.
ReplicaID
(),
Version
:
time
.
Now
()
.
UnixNano
(),
NodeID
:
action
.
Node
(),
CollectionID
:
task
.
CollectionID
(),
Infos
:
[]
*
datapb
.
VchannelInfo
{
channel
.
VchannelInfo
},
Schema
:
schema
,
// assign it for compatibility of rolling upgrade from 2.2.x to 2.3
LoadMeta
:
loadMeta
,
// assign it for compatibility of rolling upgrade from 2.2.x to 2.3
ReplicaID
:
task
.
ReplicaID
(),
Version
:
time
.
Now
()
.
UnixNano
(),
IndexInfoList
:
indexInfo
,
}
}
...
...
@@ -201,11 +203,7 @@ func getShardLeader(replicaMgr *meta.ReplicaManager, distMgr *meta.DistributionM
return
distMgr
.
GetShardLeader
(
replica
,
channel
)
}
func
getMetricType
(
ctx
context
.
Context
,
collection
int64
,
schema
*
schemapb
.
CollectionSchema
,
broker
meta
.
Broker
)
(
string
,
error
)
{
indexInfos
,
err
:=
broker
.
DescribeIndex
(
ctx
,
collection
)
if
err
!=
nil
{
return
""
,
err
}
func
getMetricType
(
indexInfos
[]
*
indexpb
.
IndexInfo
,
schema
*
schemapb
.
CollectionSchema
)
(
string
,
error
)
{
vecField
,
err
:=
typeutil
.
GetVectorFieldSchema
(
schema
)
if
err
!=
nil
{
return
""
,
err
...
...
internal/querycoordv2/task/utils_test.go
浏览文件 @
51404abe
...
...
@@ -17,22 +17,17 @@
package
task
import
(
"context"
"fmt"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"github.com/milvus-io/milvus/internal/querycoordv2/meta"
"github.com/milvus-io/milvus/pkg/common"
)
func
Test_getMetricType
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
collection
:=
int64
(
1
)
schema
:=
&
schemapb
.
CollectionSchema
{
Name
:
"TestGetMetricType"
,
...
...
@@ -50,50 +45,35 @@ func Test_getMetricType(t *testing.T) {
},
},
}
indexInfo2
:=
&
indexpb
.
IndexInfo
{
CollectionID
:
collection
,
FieldID
:
100
,
}
t
.
Run
(
"test normal"
,
func
(
t
*
testing
.
T
)
{
broker
:=
meta
.
NewMockBroker
(
t
)
broker
.
EXPECT
()
.
DescribeIndex
(
mock
.
Anything
,
collection
)
.
Return
([]
*
indexpb
.
IndexInfo
{
indexInfo
},
nil
)
metricType
,
err
:=
getMetricType
(
ctx
,
collection
,
schema
,
broker
)
metricType
,
err
:=
getMetricType
([]
*
indexpb
.
IndexInfo
{
indexInfo
},
schema
)
assert
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
"L2"
,
metricType
)
})
t
.
Run
(
"test describe index failed"
,
func
(
t
*
testing
.
T
)
{
broker
:=
meta
.
NewMockBroker
(
t
)
broker
.
EXPECT
()
.
DescribeIndex
(
mock
.
Anything
,
collection
)
.
Return
(
nil
,
fmt
.
Errorf
(
"mock err"
))
_
,
err
:=
getMetricType
(
ctx
,
collection
,
schema
,
broker
)
assert
.
Error
(
t
,
err
)
})
t
.
Run
(
"test get vec field failed"
,
func
(
t
*
testing
.
T
)
{
broker
:=
meta
.
NewMockBroker
(
t
)
broker
.
EXPECT
()
.
DescribeIndex
(
mock
.
Anything
,
collection
)
.
Return
([]
*
indexpb
.
IndexInfo
{
indexInfo
},
nil
)
_
,
err
:=
getMetricType
(
ctx
,
collection
,
&
schemapb
.
CollectionSchema
{
_
,
err
:=
getMetricType
([]
*
indexpb
.
IndexInfo
{
indexInfo
},
&
schemapb
.
CollectionSchema
{
Name
:
"TestGetMetricType"
,
}
,
broker
)
})
assert
.
Error
(
t
,
err
)
})
t
.
Run
(
"test field id mismatch"
,
func
(
t
*
testing
.
T
)
{
broker
:=
meta
.
NewMockBroker
(
t
)
broker
.
EXPECT
()
.
DescribeIndex
(
mock
.
Anything
,
collection
)
.
Return
([]
*
indexpb
.
IndexInfo
{
indexInfo
},
nil
)
_
,
err
:=
getMetricType
(
ctx
,
collection
,
&
schemapb
.
CollectionSchema
{
_
,
err
:=
getMetricType
([]
*
indexpb
.
IndexInfo
{
indexInfo
},
&
schemapb
.
CollectionSchema
{
Name
:
"TestGetMetricType"
,
Fields
:
[]
*
schemapb
.
FieldSchema
{
{
FieldID
:
-
1
,
Name
:
"vec"
,
DataType
:
schemapb
.
DataType_FloatVector
},
},
}
,
broker
)
})
assert
.
Error
(
t
,
err
)
})
t
.
Run
(
"test no metric type"
,
func
(
t
*
testing
.
T
)
{
broker
:=
meta
.
NewMockBroker
(
t
)
broker
.
EXPECT
()
.
DescribeIndex
(
mock
.
Anything
,
collection
)
.
Return
([]
*
indexpb
.
IndexInfo
{{
CollectionID
:
collection
,
FieldID
:
100
,
}},
nil
)
_
,
err
:=
getMetricType
(
ctx
,
collection
,
schema
,
broker
)
_
,
err
:=
getMetricType
([]
*
indexpb
.
IndexInfo
{
indexInfo2
},
schema
)
assert
.
Error
(
t
,
err
)
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录