Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
86ca96a0
M
milvus
项目概览
milvus
/
milvus
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
未验证
提交
86ca96a0
编写于
8月 13, 2021
作者:
X
XuanYang-cn
提交者:
GitHub
8月 13, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix master branch unittest error (#7083)
Resolves: #7080 Signed-off-by:
N
yangxuan
<
xuan.yang@zilliz.com
>
上级
6c5be83e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
49 addition
and
53 deletion
+49
-53
internal/datanode/data_node.go
internal/datanode/data_node.go
+2
-2
internal/datanode/data_node_test.go
internal/datanode/data_node_test.go
+47
-51
未找到文件。
internal/datanode/data_node.go
浏览文件 @
86ca96a0
...
...
@@ -320,11 +320,11 @@ func (node *DataNode) Start() error {
}
connectEtcdFn
:=
func
()
error
{
etcd
Client
,
err
:=
clientv3
.
New
(
clientv3
.
Config
{
Endpoints
:
Params
.
EtcdEndpoints
}
)
etcd
KV
,
err
:=
etcdkv
.
NewEtcdKV
(
Params
.
EtcdEndpoints
,
Params
.
MetaRootPath
)
if
err
!=
nil
{
return
err
}
node
.
kvClient
=
etcd
kv
.
NewEtcdKV
(
etcdClient
,
Params
.
MetaRootPath
)
node
.
kvClient
=
etcd
KV
return
nil
}
err
=
retry
.
Do
(
node
.
ctx
,
connectEtcdFn
,
retry
.
Attempts
(
ConnectEtcdMaxRetryTime
))
...
...
internal/datanode/data_node_test.go
浏览文件 @
86ca96a0
...
...
@@ -24,7 +24,6 @@ import (
"github.com/golang/protobuf/proto"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.etcd.io/etcd/clientv3"
"go.uber.org/zap"
etcdkv
"github.com/milvus-io/milvus/internal/kv/etcd"
...
...
@@ -333,59 +332,56 @@ func TestWatchChannel(t *testing.T) {
defer
cancel
()
t
.
Run
(
"test watch channel"
,
func
(
t
*
testing
.
T
)
{
client
,
err
:=
clientv3
.
New
(
clientv3
.
Config
{
Endpoints
:
Params
.
EtcdEndpoints
})
assert
.
Nil
(
t
,
err
)
if
assert
.
NotNil
(
t
,
client
)
{
kv
:=
etcdkv
.
NewEtcdKV
(
client
,
Params
.
MetaRootPath
)
ch
:=
fmt
.
Sprintf
(
"datanode-etcd-test-channel_%d"
,
rand
.
Int31
())
path
:=
fmt
.
Sprintf
(
"channel/%d/%s"
,
node
.
NodeID
,
ch
)
c
:=
make
(
chan
struct
{})
go
func
()
{
ec
:=
kv
.
WatchWithPrefix
(
fmt
.
Sprintf
(
"channel/%d"
,
node
.
NodeID
))
cnt
:=
0
for
{
evt
:=
<-
ec
for
_
,
event
:=
range
evt
.
Events
{
if
strings
.
Contains
(
string
(
event
.
Kv
.
Key
),
ch
)
{
cnt
++
}
}
if
cnt
>=
2
{
break
kv
,
err
:=
etcdkv
.
NewEtcdKV
(
Params
.
EtcdEndpoints
,
Params
.
MetaRootPath
)
require
.
NoError
(
t
,
err
)
ch
:=
fmt
.
Sprintf
(
"datanode-etcd-test-channel_%d"
,
rand
.
Int31
())
path
:=
fmt
.
Sprintf
(
"channel/%d/%s"
,
node
.
NodeID
,
ch
)
c
:=
make
(
chan
struct
{})
go
func
()
{
ec
:=
kv
.
WatchWithPrefix
(
fmt
.
Sprintf
(
"channel/%d"
,
node
.
NodeID
))
cnt
:=
0
for
{
evt
:=
<-
ec
for
_
,
event
:=
range
evt
.
Events
{
if
strings
.
Contains
(
string
(
event
.
Kv
.
Key
),
ch
)
{
cnt
++
}
}
c
<-
struct
{}{}
}()
vchan
:=
&
datapb
.
VchannelInfo
{
CollectionID
:
1
,
ChannelName
:
ch
,
UnflushedSegments
:
[]
*
datapb
.
SegmentInfo
{},
}
info
:=
&
datapb
.
ChannelWatchInfo
{
State
:
datapb
.
ChannelWatchState_Uncomplete
,
Vchan
:
vchan
,
if
cnt
>=
2
{
break
}
}
val
,
err
:=
proto
.
Marshal
(
info
)
assert
.
Nil
(
t
,
err
)
err
=
kv
.
Save
(
path
,
string
(
val
))
assert
.
Nil
(
t
,
err
)
<-
c
node
.
chanMut
.
RLock
()
_
,
has
:=
node
.
vchan2SyncService
[
ch
]
node
.
chanMut
.
RUnlock
()
assert
.
True
(
t
,
has
)
kv
.
RemoveWithPrefix
(
fmt
.
Sprintf
(
"channel/%d"
,
node
.
NodeID
))
//TODO there is not way to sync Release done, use sleep for now
time
.
Sleep
(
100
*
time
.
Millisecond
)
node
.
chanMut
.
RLock
()
_
,
has
=
node
.
vchan2SyncService
[
ch
]
node
.
chanMut
.
RUnlock
()
assert
.
False
(
t
,
has
)
c
<-
struct
{}{}
}()
vchan
:=
&
datapb
.
VchannelInfo
{
CollectionID
:
1
,
ChannelName
:
ch
,
UnflushedSegments
:
[]
*
datapb
.
SegmentInfo
{},
}
info
:=
&
datapb
.
ChannelWatchInfo
{
State
:
datapb
.
ChannelWatchState_Uncomplete
,
Vchan
:
vchan
,
}
val
,
err
:=
proto
.
Marshal
(
info
)
assert
.
Nil
(
t
,
err
)
err
=
kv
.
Save
(
path
,
string
(
val
))
assert
.
Nil
(
t
,
err
)
<-
c
node
.
chanMut
.
RLock
()
_
,
has
:=
node
.
vchan2SyncService
[
ch
]
node
.
chanMut
.
RUnlock
()
assert
.
True
(
t
,
has
)
kv
.
RemoveWithPrefix
(
fmt
.
Sprintf
(
"channel/%d"
,
node
.
NodeID
))
//TODO there is not way to sync Release done, use sleep for now
time
.
Sleep
(
100
*
time
.
Millisecond
)
node
.
chanMut
.
RLock
()
_
,
has
=
node
.
vchan2SyncService
[
ch
]
node
.
chanMut
.
RUnlock
()
assert
.
False
(
t
,
has
)
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录