Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
8a4c6a03
M
milvus
项目概览
milvus
/
milvus
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
8a4c6a03
编写于
3月 25, 2021
作者:
B
bigsheeper
提交者:
yefu.chen
3月 25, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add search log
Signed-off-by:
N
bigsheeper
<
yihao.dai@zilliz.com
>
上级
7e60460a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
48 addition
and
9 deletion
+48
-9
internal/querynode/search_collection.go
internal/querynode/search_collection.go
+42
-6
internal/querynode/search_service.go
internal/querynode/search_service.go
+6
-3
未找到文件。
internal/querynode/search_collection.go
浏览文件 @
8a4c6a03
...
...
@@ -132,23 +132,34 @@ func (s *searchCollection) receiveSearchMsg() {
for
{
select
{
case
<-
s
.
releaseCtx
.
Done
()
:
log
.
Debug
(
"stop receiveSearchMsg"
,
zap
.
Int64
(
"collectionID"
,
s
.
collectionID
))
log
.
Debug
(
"stop
searchCollection's
receiveSearchMsg"
,
zap
.
Int64
(
"collectionID"
,
s
.
collectionID
))
return
case
sm
:=
<-
s
.
msgBuffer
:
log
.
Debug
(
"get search message from msgBuffer"
,
zap
.
Int64
(
"msgID"
,
sm
.
ID
()),
zap
.
Int64
(
"collectionID"
,
sm
.
CollectionID
))
serviceTime
:=
s
.
getServiceableTime
()
if
sm
.
BeginTs
()
>
serviceTime
{
s
.
addToUnsolvedMsg
(
sm
)
continue
}
log
.
Debug
(
"doing search in receiveSearchMsg..."
,
zap
.
Int64
(
"msgID"
,
sm
.
ID
()),
zap
.
Int64
(
"collectionID"
,
sm
.
CollectionID
))
err
:=
s
.
search
(
sm
)
if
err
!=
nil
{
log
.
Error
(
err
.
Error
())
log
.
Debug
(
"do search failed in receiveSearchMsg, prepare to publish failed search result"
,
zap
.
Int64
(
"msgID"
,
sm
.
ID
()),
zap
.
Int64
(
"collectionID"
,
sm
.
CollectionID
))
err2
:=
s
.
publishFailedSearchResult
(
sm
,
err
.
Error
())
if
err2
!=
nil
{
log
.
Error
(
"publish FailedSearchResult failed"
,
zap
.
Error
(
err2
))
}
}
log
.
Debug
(
"ReceiveSearchMsg, do search done, num of searchMsg = 1"
)
log
.
Debug
(
"do search done in receiveSearchMsg"
,
zap
.
Int64
(
"msgID"
,
sm
.
ID
()),
zap
.
Int64
(
"collectionID"
,
sm
.
CollectionID
))
}
}
}
...
...
@@ -157,7 +168,7 @@ func (s *searchCollection) doUnsolvedMsgSearch() {
for
{
select
{
case
<-
s
.
releaseCtx
.
Done
()
:
log
.
Debug
(
"stop doUnsolvedMsgSearch"
,
zap
.
Int64
(
"collectionID"
,
s
.
collectionID
))
log
.
Debug
(
"stop
searchCollection's
doUnsolvedMsgSearch"
,
zap
.
Int64
(
"collectionID"
,
s
.
collectionID
))
return
default
:
serviceTime
,
err
:=
s
.
waitNewTSafe
()
...
...
@@ -166,11 +177,17 @@ func (s *searchCollection) doUnsolvedMsgSearch() {
// TODO: emptySearch or continue, note: collection has been released
continue
}
log
.
Debug
(
"get tSafe from flow graph"
,
zap
.
Int64
(
"collectionID"
,
s
.
collectionID
),
zap
.
Uint64
(
"tSafe"
,
serviceTime
))
searchMsg
:=
make
([]
*
msgstream
.
SearchMsg
,
0
)
tempMsg
:=
s
.
popAllUnsolvedMsg
()
for
_
,
sm
:=
range
tempMsg
{
log
.
Debug
(
"get search message from unsolvedMsg"
,
zap
.
Int64
(
"msgID"
,
sm
.
ID
()),
zap
.
Int64
(
"collectionID"
,
sm
.
CollectionID
))
if
sm
.
EndTs
()
<=
serviceTime
{
searchMsg
=
append
(
searchMsg
,
sm
)
continue
...
...
@@ -184,15 +201,24 @@ func (s *searchCollection) doUnsolvedMsgSearch() {
for
_
,
sm
:=
range
searchMsg
{
sp
,
ctx
:=
trace
.
StartSpanFromContext
(
sm
.
TraceCtx
())
sm
.
SetTraceCtx
(
ctx
)
log
.
Debug
(
"doing search in doUnsolvedMsgSearch..."
,
zap
.
Int64
(
"msgID"
,
sm
.
ID
()),
zap
.
Int64
(
"collectionID"
,
sm
.
CollectionID
))
err
:=
s
.
search
(
sm
)
if
err
!=
nil
{
log
.
Error
(
err
.
Error
())
log
.
Debug
(
"do search failed in doUnsolvedMsgSearch, prepare to publish failed search result"
,
zap
.
Int64
(
"msgID"
,
sm
.
ID
()),
zap
.
Int64
(
"collectionID"
,
sm
.
CollectionID
))
err2
:=
s
.
publishFailedSearchResult
(
sm
,
err
.
Error
())
if
err2
!=
nil
{
log
.
Error
(
"publish FailedSearchResult failed"
,
zap
.
Error
(
err2
))
}
}
sp
.
Finish
()
log
.
Debug
(
"do search done in doUnsolvedMsgSearch"
,
zap
.
Int64
(
"msgID"
,
sm
.
ID
()),
zap
.
Int64
(
"collectionID"
,
sm
.
CollectionID
))
}
log
.
Debug
(
"doUnsolvedMsgSearch, do search done"
,
zap
.
Int
(
"num of searchMsg"
,
len
(
searchMsg
)))
}
...
...
@@ -304,7 +330,7 @@ func (s *searchCollection) search(searchMsg *msgstream.SearchMsg) error {
MetricType
:
plan
.
getMetricType
(),
},
}
err
=
s
.
publishSearchResult
(
searchResultMsg
)
err
=
s
.
publishSearchResult
(
searchResultMsg
,
searchMsg
.
CollectionID
)
if
err
!=
nil
{
return
err
}
...
...
@@ -378,7 +404,7 @@ func (s *searchCollection) search(searchMsg *msgstream.SearchMsg) error {
// fmt.Println(testHits.IDs)
// fmt.Println(testHits.Scores)
//}
err
=
s
.
publishSearchResult
(
searchResultMsg
)
err
=
s
.
publishSearchResult
(
searchResultMsg
,
searchMsg
.
CollectionID
)
if
err
!=
nil
{
return
err
}
...
...
@@ -391,13 +417,23 @@ func (s *searchCollection) search(searchMsg *msgstream.SearchMsg) error {
return
nil
}
func
(
s
*
searchCollection
)
publishSearchResult
(
msg
msgstream
.
TsMsg
)
error
{
func
(
s
*
searchCollection
)
publishSearchResult
(
msg
msgstream
.
TsMsg
,
collectionID
UniqueID
)
error
{
log
.
Debug
(
"publishing search result..."
,
zap
.
Int64
(
"msgID"
,
msg
.
ID
()),
zap
.
Int64
(
"collectionID"
,
collectionID
))
span
,
ctx
:=
trace
.
StartSpanFromContext
(
msg
.
TraceCtx
())
defer
span
.
Finish
()
msg
.
SetTraceCtx
(
ctx
)
msgPack
:=
msgstream
.
MsgPack
{}
msgPack
.
Msgs
=
append
(
msgPack
.
Msgs
,
msg
)
err
:=
s
.
searchResultMsgStream
.
Produce
(
&
msgPack
)
if
err
!=
nil
{
log
.
Error
(
err
.
Error
())
}
else
{
log
.
Debug
(
"publish search result done"
,
zap
.
Int64
(
"msgID"
,
msg
.
ID
()),
zap
.
Int64
(
"collectionID"
,
collectionID
))
}
return
err
}
...
...
internal/querynode/search_service.go
浏览文件 @
8a4c6a03
...
...
@@ -82,8 +82,8 @@ func (s *searchService) consumeSearch() {
if
msgPack
==
nil
||
len
(
msgPack
.
Msgs
)
<=
0
{
continue
}
emptySearchNum
:=
0
for
_
,
msg
:=
range
msgPack
.
Msgs
{
log
.
Debug
(
"consume search message"
,
zap
.
Int64
(
"msgID"
,
msg
.
ID
()))
sm
,
ok
:=
msg
.
(
*
msgstream
.
SearchMsg
)
if
!
ok
{
continue
...
...
@@ -93,17 +93,20 @@ func (s *searchService) consumeSearch() {
err
:=
s
.
collectionCheck
(
sm
.
CollectionID
)
if
err
!=
nil
{
s
.
emptySearchCollection
.
emptySearch
(
sm
)
emptySearchNum
++
log
.
Debug
(
"cannot found collection, do empty search done"
,
zap
.
Int64
(
"msgID"
,
sm
.
ID
()),
zap
.
Int64
(
"collectionID"
,
sm
.
CollectionID
))
continue
}
sc
,
ok
:=
s
.
searchCollections
[
sm
.
CollectionID
]
if
!
ok
{
s
.
startSearchCollection
(
sm
.
CollectionID
)
log
.
Debug
(
"new search collection, start search collection service"
,
zap
.
Int64
(
"collectionID"
,
sm
.
CollectionID
))
}
sc
.
msgBuffer
<-
sm
sp
.
Finish
()
}
log
.
Debug
(
"do empty search done"
,
zap
.
Int
(
"num of searchMsg"
,
emptySearchNum
))
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录