Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
2aa9deda
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,发现更多精彩内容 >>
未验证
提交
2aa9deda
编写于
9月 23, 2021
作者:
C
congqixia
提交者:
GitHub
9月 23, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve logic when watch dm channel fails (#8386)
Signed-off-by:
N
Congqi Xia
<
congqi.xia@zilliz.com
>
上级
da6d9352
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
69 addition
and
5 deletion
+69
-5
internal/datanode/data_node.go
internal/datanode/data_node.go
+6
-1
internal/datanode/data_node_test.go
internal/datanode/data_node_test.go
+39
-0
internal/datanode/data_sync_service.go
internal/datanode/data_sync_service.go
+5
-1
internal/datanode/flow_graph_dmstream_input_node.go
internal/datanode/flow_graph_dmstream_input_node.go
+6
-3
internal/datanode/mock_test.go
internal/datanode/mock_test.go
+13
-0
未找到文件。
internal/datanode/data_node.go
浏览文件 @
2aa9deda
...
...
@@ -405,7 +405,12 @@ func (node *DataNode) WatchDmChannels(ctx context.Context, in *datapb.WatchDmCha
zap
.
Any
(
"channal Info"
,
chanInfo
),
)
if
err
:=
node
.
NewDataSyncService
(
chanInfo
);
err
!=
nil
{
log
.
Warn
(
"Failed to new data sync service"
,
zap
.
Any
(
"channel"
,
chanInfo
))
log
.
Warn
(
"Failed to new data sync service"
,
zap
.
Any
(
"channel"
,
chanInfo
),
zap
.
Error
(
err
))
// return error even partial success
status
.
Reason
=
err
.
Error
()
return
status
,
nil
}
}
...
...
internal/datanode/data_node_test.go
浏览文件 @
2aa9deda
...
...
@@ -120,6 +120,41 @@ func TestDataNode(t *testing.T) {
}
})
t
.
Run
(
"Test WatchDmChannels fails"
,
func
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
node
:=
newIDLEDataNodeMock
(
ctx
)
// before healthy
status
,
err
:=
node
.
WatchDmChannels
(
ctx
,
&
datapb
.
WatchDmChannelsRequest
{})
assert
.
Nil
(
t
,
err
)
assert
.
Equal
(
t
,
commonpb
.
ErrorCode_UnexpectedError
,
status
.
ErrorCode
)
node
.
Init
()
node
.
Start
()
node
.
Register
()
defer
func
()
{
err
:=
node
.
Stop
()
assert
.
Nil
(
t
,
err
)
}()
node
.
msFactory
=
&
FailMessageStreamFactory
{
Factory
:
node
.
msFactory
,
}
status
,
err
=
node
.
WatchDmChannels
(
ctx
,
&
datapb
.
WatchDmChannelsRequest
{
Vchannels
:
[]
*
datapb
.
VchannelInfo
{
{
CollectionID
:
collectionID0
,
ChannelName
:
"test_channel_name"
,
},
},
})
assert
.
Nil
(
t
,
err
)
assert
.
Equal
(
t
,
commonpb
.
ErrorCode_UnexpectedError
,
status
.
ErrorCode
)
})
t
.
Run
(
"Test GetComponentStates"
,
func
(
t
*
testing
.
T
)
{
stat
,
err
:=
node
.
GetComponentStates
(
node
.
ctx
)
assert
.
NoError
(
t
,
err
)
...
...
@@ -505,4 +540,8 @@ func TestWatchChannel(t *testing.T) {
node
.
chanMut
.
RUnlock
()
assert
.
False
(
t
,
has
)
})
t
.
Run
(
"watch dm channel fails"
,
func
(
t
*
testing
.
T
)
{
node
.
WatchDmChannels
(
context
.
Background
(),
&
datapb
.
WatchDmChannelsRequest
{})
})
}
internal/datanode/data_sync_service.go
浏览文件 @
2aa9deda
...
...
@@ -163,13 +163,17 @@ func (dsService *dataSyncService) initNodes(vchanInfo *datapb.VchannelInfo) erro
dsService
.
saveBinlog
=
saveBinlog
var
dmStreamNode
Node
=
newDmInputNode
(
var
dmStreamNode
Node
dmStreamNode
,
err
=
newDmInputNode
(
dsService
.
ctx
,
dsService
.
msFactory
,
vchanInfo
.
CollectionID
,
vchanInfo
.
GetChannelName
(),
vchanInfo
.
GetSeekPosition
(),
)
if
err
!=
nil
{
return
err
}
var
ddNode
Node
=
newDDNode
(
dsService
.
clearSignal
,
dsService
.
collectionID
,
vchanInfo
)
var
insertBufferNode
Node
insertBufferNode
,
err
=
newInsertBufferNode
(
...
...
internal/datanode/flow_graph_dmstream_input_node.go
浏览文件 @
2aa9deda
...
...
@@ -22,13 +22,16 @@ import (
"github.com/milvus-io/milvus/internal/util/flowgraph"
)
func
newDmInputNode
(
ctx
context
.
Context
,
factory
msgstream
.
Factory
,
collID
UniqueID
,
chanName
string
,
seekPos
*
internalpb
.
MsgPosition
)
*
flowgraph
.
InputNode
{
func
newDmInputNode
(
ctx
context
.
Context
,
factory
msgstream
.
Factory
,
collID
UniqueID
,
chanName
string
,
seekPos
*
internalpb
.
MsgPosition
)
(
*
flowgraph
.
InputNode
,
error
)
{
maxQueueLength
:=
Params
.
FlowGraphMaxQueueLength
maxParallelism
:=
Params
.
FlowGraphMaxParallelism
// subName should be unique, since pchannelName is shared among several collections
consumeSubName
:=
Params
.
MsgChannelSubName
+
"-"
+
strconv
.
FormatInt
(
collID
,
10
)
insertStream
,
_
:=
factory
.
NewTtMsgStream
(
ctx
)
insertStream
,
err
:=
factory
.
NewTtMsgStream
(
ctx
)
if
err
!=
nil
{
return
nil
,
err
}
pchannelName
:=
rootcoord
.
ToPhysicalChannel
(
chanName
)
insertStream
.
AsConsumer
([]
string
{
pchannelName
},
consumeSubName
)
...
...
@@ -43,5 +46,5 @@ func newDmInputNode(ctx context.Context, factory msgstream.Factory, collID Uniqu
var
stream
msgstream
.
MsgStream
=
insertStream
node
:=
flowgraph
.
NewInputNode
(
&
stream
,
"dmInputNode"
,
maxQueueLength
,
maxParallelism
)
return
node
return
node
,
nil
}
internal/datanode/mock_test.go
浏览文件 @
2aa9deda
...
...
@@ -543,3 +543,16 @@ func (m *RootCoordFactory) GetComponentStates(ctx context.Context) (*internalpb.
},
},
nil
}
// FailMessageStreamFactory mock MessageStreamFactory failure
type
FailMessageStreamFactory
struct
{
msgstream
.
Factory
}
func
(
f
*
FailMessageStreamFactory
)
NewMsgStream
(
ctx
context
.
Context
)
(
msgstream
.
MsgStream
,
error
)
{
return
nil
,
errors
.
New
(
"mocked failure"
)
}
func
(
f
*
FailMessageStreamFactory
)
NewTtMsgStream
(
ctx
context
.
Context
)
(
msgstream
.
MsgStream
,
error
)
{
return
nil
,
errors
.
New
(
"mocked failure"
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录