Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
dca6c6af
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,发现更多精彩内容 >>
未验证
提交
dca6c6af
编写于
7月 15, 2021
作者:
X
XuanYang-cn
提交者:
GitHub
7月 15, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add unittest for BackGroundGC in DataNode (#6522)
Signed-off-by:
N
yangxuan
<
xuan.yang@zilliz.com
>
上级
34370e2c
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
45 addition
and
38 deletion
+45
-38
internal/datanode/data_node_test.go
internal/datanode/data_node_test.go
+44
-38
internal/datanode/flow_graph_dd_node.go
internal/datanode/flow_graph_dd_node.go
+1
-0
未找到文件。
internal/datanode/data_node_test.go
浏览文件 @
dca6c6af
...
...
@@ -203,8 +203,48 @@ func TestDataNode(t *testing.T) {
assert
.
NoError
(
t
,
err
)
})
t
.
Run
(
"Test BackGroundGC"
,
func
(
te
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
node
:=
newIDLEDataNodeMock
(
ctx
)
collIDCh
:=
make
(
chan
UniqueID
)
go
node
.
BackGroundGC
(
collIDCh
)
node
.
clearSignal
=
collIDCh
testDataSyncs
:=
[]
struct
{
collID
UniqueID
dmChannelName
string
}{
{
1
,
"fake-dm-backgroundgc-1"
},
{
2
,
"fake-dm-backgroundgc-2"
},
{
3
,
"fake-dm-backgroundgc-3"
},
{
4
,
""
},
{
1
,
""
},
}
for
i
,
t
:=
range
testDataSyncs
{
if
i
<=
2
{
node
.
NewDataSyncService
(
&
datapb
.
VchannelInfo
{
CollectionID
:
t
.
collID
,
ChannelName
:
t
.
dmChannelName
})
msFactory
:=
msgstream
.
NewPmsFactory
()
insertStream
,
_
:=
msFactory
.
NewMsgStream
(
ctx
)
var
insertMsgStream
msgstream
.
MsgStream
=
insertStream
insertMsgStream
.
Start
()
}
collIDCh
<-
t
.
collID
}
assert
.
Eventually
(
t
,
func
()
bool
{
node
.
chanMut
.
Lock
()
defer
node
.
chanMut
.
Unlock
()
return
len
(
node
.
vchan2FlushCh
)
==
0
},
time
.
Second
,
time
.
Millisecond
)
cancel
()
})
t
.
Run
(
"Test ReleaseDataSyncService"
,
func
(
t
*
testing
.
T
)
{
t
.
Skip
()
dmChannelName
:=
"fake-dm-channel-test-NewDataSyncService"
vchan
:=
&
datapb
.
VchannelInfo
{
...
...
@@ -214,9 +254,9 @@ func TestDataNode(t *testing.T) {
}
err
:=
node
.
NewDataSyncService
(
vchan
)
assert
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
1
,
len
(
node
.
vchan2FlushCh
))
assert
.
Equal
(
t
,
1
,
len
(
node
.
vchan2SyncService
))
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
1
,
len
(
node
.
vchan2FlushCh
))
require
.
Equal
(
t
,
1
,
len
(
node
.
vchan2SyncService
))
time
.
Sleep
(
time
.
Second
)
node
.
ReleaseDataSyncService
(
dmChannelName
)
...
...
@@ -275,40 +315,6 @@ func TestDataNode(t *testing.T) {
cancel
()
})
t
.
Run
(
"Test BackGroundGC"
,
func
(
t
*
testing
.
T
)
{
t
.
Skipf
(
"Skip for data race"
)
collIDCh
:=
make
(
chan
UniqueID
)
go
node
.
BackGroundGC
(
collIDCh
)
dmChannelName
:=
"fake-dm-channel-test-BackGroundGC"
vchan
:=
&
datapb
.
VchannelInfo
{
CollectionID
:
1
,
ChannelName
:
dmChannelName
,
UnflushedSegments
:
[]
*
datapb
.
SegmentInfo
{},
}
require
.
Equal
(
t
,
0
,
len
(
node
.
vchan2FlushCh
))
require
.
Equal
(
t
,
0
,
len
(
node
.
vchan2SyncService
))
err
:=
node
.
NewDataSyncService
(
vchan
)
require
.
NoError
(
t
,
err
)
time
.
Sleep
(
time
.
Second
)
require
.
Equal
(
t
,
1
,
len
(
node
.
vchan2FlushCh
))
require
.
Equal
(
t
,
1
,
len
(
node
.
vchan2SyncService
))
collIDCh
<-
1
assert
.
Eventually
(
t
,
func
()
bool
{
return
len
(
node
.
vchan2FlushCh
)
==
0
},
time
.
Second
*
4
,
time
.
Millisecond
)
assert
.
Equal
(
t
,
0
,
len
(
node
.
vchan2SyncService
))
s
,
ok
:=
node
.
vchan2SyncService
[
dmChannelName
]
assert
.
False
(
t
,
ok
)
assert
.
Nil
(
t
,
s
)
})
cancel
()
<-
node
.
ctx
.
Done
()
node
.
Stop
()
...
...
internal/datanode/flow_graph_dd_node.go
浏览文件 @
dca6c6af
...
...
@@ -88,6 +88,7 @@ func (ddn *ddNode) Operate(in []flowgraph.Msg) []flowgraph.Msg {
if
msg
.
(
*
msgstream
.
DropCollectionMsg
)
.
GetCollectionID
()
==
ddn
.
collectionID
{
log
.
Info
(
"Destroying current flowgraph"
,
zap
.
Any
(
"collectionID"
,
ddn
.
collectionID
))
ddn
.
clearSignal
<-
ddn
.
collectionID
return
[]
Msg
{}
}
case
commonpb
.
MsgType_Insert
:
log
.
Debug
(
"DDNode with insert messages"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录