Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
55f1e03c
M
milvus
项目概览
milvus
/
milvus
10 个月 前同步成功
通知
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 搜索 >>
未验证
提交
55f1e03c
编写于
5月 27, 2022
作者:
C
congqixia
提交者:
GitHub
5月 27, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow DataNode clean vchannel with meta error without panicking (#17247)
Signed-off-by:
N
Congqi Xia
<
congqi.xia@zilliz.com
>
上级
ad9276a4
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
66 addition
and
23 deletion
+66
-23
internal/datacoord/server_test.go
internal/datacoord/server_test.go
+22
-1
internal/datacoord/services.go
internal/datacoord/services.go
+2
-0
internal/datanode/flush_manager.go
internal/datanode/flush_manager.go
+13
-2
internal/datanode/flush_manager_test.go
internal/datanode/flush_manager_test.go
+23
-3
internal/datanode/mock_test.go
internal/datanode/mock_test.go
+6
-17
未找到文件。
internal/datacoord/server_test.go
浏览文件 @
55f1e03c
...
...
@@ -853,6 +853,27 @@ func TestSaveBinlogPaths(t *testing.T) {
assert
.
EqualValues
(
t
,
segmentInfo
.
NumOfRows
,
10
)
})
t
.
Run
(
"with channel not matched"
,
func
(
t
*
testing
.
T
)
{
svr
:=
newTestServer
(
t
,
nil
)
defer
closeTestServer
(
t
,
svr
)
err
:=
svr
.
channelManager
.
AddNode
(
0
)
require
.
Nil
(
t
,
err
)
err
=
svr
.
channelManager
.
Watch
(
&
channel
{
"ch1"
,
0
})
require
.
Nil
(
t
,
err
)
s
:=
&
datapb
.
SegmentInfo
{
ID
:
1
,
InsertChannel
:
"ch2"
,
State
:
commonpb
.
SegmentState_Growing
,
}
svr
.
meta
.
AddSegment
(
NewSegmentInfo
(
s
))
resp
,
err
:=
svr
.
SaveBinlogPaths
(
context
.
Background
(),
&
datapb
.
SaveBinlogPathsRequest
{
SegmentID
:
1
,
})
assert
.
Nil
(
t
,
err
)
assert
.
Equal
(
t
,
commonpb
.
ErrorCode_MetaFailed
,
resp
.
GetErrorCode
())
})
t
.
Run
(
"with closed server"
,
func
(
t
*
testing
.
T
)
{
svr
:=
newTestServer
(
t
,
nil
)
closeTestServer
(
t
,
svr
)
...
...
@@ -1038,7 +1059,7 @@ func TestDropVirtualChannel(t *testing.T) {
ChannelName
:
"ch2"
,
})
assert
.
Nil
(
t
,
err
)
assert
.
Equal
(
t
,
commonpb
.
ErrorCode_
UnexpectedError
,
resp
.
GetStatus
()
.
GetErrorCode
())
assert
.
Equal
(
t
,
commonpb
.
ErrorCode_
MetaFailed
,
resp
.
GetStatus
()
.
GetErrorCode
())
})
t
.
Run
(
"with closed server"
,
func
(
t
*
testing
.
T
)
{
...
...
internal/datacoord/services.go
浏览文件 @
55f1e03c
...
...
@@ -335,6 +335,7 @@ func (s *Server) SaveBinlogPaths(ctx context.Context, req *datapb.SaveBinlogPath
channel
:=
segment
.
GetInsertChannel
()
if
!
s
.
channelManager
.
Match
(
nodeID
,
channel
)
{
FailResponse
(
resp
,
fmt
.
Sprintf
(
"channel %s is not watched on node %d"
,
channel
,
nodeID
))
resp
.
ErrorCode
=
commonpb
.
ErrorCode_MetaFailed
log
.
Warn
(
"node is not matched with channel"
,
zap
.
String
(
"channel"
,
channel
),
zap
.
Int64
(
"nodeID"
,
nodeID
))
return
resp
,
nil
}
...
...
@@ -412,6 +413,7 @@ func (s *Server) DropVirtualChannel(ctx context.Context, req *datapb.DropVirtual
nodeID
:=
req
.
GetBase
()
.
GetSourceID
()
if
!
s
.
channelManager
.
Match
(
nodeID
,
channel
)
{
FailResponse
(
resp
.
Status
,
fmt
.
Sprintf
(
"channel %s is not watched on node %d"
,
channel
,
nodeID
))
resp
.
Status
.
ErrorCode
=
commonpb
.
ErrorCode_MetaFailed
log
.
Warn
(
"node is not matched with channel"
,
zap
.
String
(
"channel"
,
channel
),
zap
.
Int64
(
"nodeID"
,
nodeID
))
return
resp
,
nil
}
...
...
internal/datanode/flush_manager.go
浏览文件 @
55f1e03c
...
...
@@ -686,7 +686,13 @@ func dropVirtualChannelFunc(dsService *dataSyncService, opts ...retry.Option) fl
return
fmt
.
Errorf
(
err
.
Error
())
}
// TODO should retry only when datacoord status is unhealthy
// meta error, datanode handles a virtual channel does not belong here
if
rsp
.
GetStatus
()
.
GetErrorCode
()
==
commonpb
.
ErrorCode_MetaFailed
{
log
.
Warn
(
"meta error found, skip sync and start to drop virtual channel"
,
zap
.
String
(
"channel"
,
dsService
.
vchannelName
))
return
nil
}
// retry for other error
if
rsp
.
GetStatus
()
.
GetErrorCode
()
!=
commonpb
.
ErrorCode_Success
{
return
fmt
.
Errorf
(
"data service DropVirtualChannel failed, reason = %s"
,
rsp
.
GetStatus
()
.
GetReason
())
}
...
...
@@ -772,7 +778,12 @@ func flushNotifyFunc(dsService *dataSyncService, opts ...retry.Option) notifyMet
return
fmt
.
Errorf
(
err
.
Error
())
}
// TODO should retry only when datacoord status is unhealthy
// meta error, datanode handles a virtual channel does not belong here
if
rsp
.
GetErrorCode
()
==
commonpb
.
ErrorCode_MetaFailed
{
log
.
Warn
(
"meta error found, skip sync and start to drop virtual channel"
,
zap
.
String
(
"channel"
,
dsService
.
vchannelName
))
return
nil
}
if
rsp
.
ErrorCode
!=
commonpb
.
ErrorCode_Success
{
return
fmt
.
Errorf
(
"data service save bin log path failed, reason = %s"
,
rsp
.
Reason
)
}
...
...
internal/datanode/flush_manager_test.go
浏览文件 @
55f1e03c
...
...
@@ -24,6 +24,7 @@ import (
"testing"
"time"
"github.com/milvus-io/milvus/internal/proto/commonpb"
"github.com/milvus-io/milvus/internal/proto/datapb"
"github.com/milvus-io/milvus/internal/proto/internalpb"
"github.com/milvus-io/milvus/internal/proto/schemapb"
...
...
@@ -555,12 +556,21 @@ func TestFlushNotifyFunc(t *testing.T) {
})
t
.
Run
(
"datacoord Save fails"
,
func
(
t
*
testing
.
T
)
{
dataCoord
.
SaveBinlogPath
NotSuccess
=
true
dataCoord
.
SaveBinlogPath
Status
=
commonpb
.
ErrorCode_UnexpectedError
assert
.
Panics
(
t
,
func
()
{
notifyFunc
(
&
segmentFlushPack
{})
})
})
// issue https://github.com/milvus-io/milvus/issues/17097
// meta error, datanode shall not panic, just drop the virtual channel
t
.
Run
(
"datacoord found meta error"
,
func
(
t
*
testing
.
T
)
{
dataCoord
.
SaveBinlogPathStatus
=
commonpb
.
ErrorCode_MetaFailed
assert
.
NotPanics
(
t
,
func
()
{
notifyFunc
(
&
segmentFlushPack
{})
})
})
t
.
Run
(
"datacoord call error"
,
func
(
t
*
testing
.
T
)
{
dataCoord
.
SaveBinlogPathError
=
true
assert
.
Panics
(
t
,
func
()
{
...
...
@@ -623,7 +633,7 @@ func TestDropVirtualChannelFunc(t *testing.T) {
})
})
t
.
Run
(
"datacoord drop fails"
,
func
(
t
*
testing
.
T
)
{
dataCoord
.
DropVirtualChannel
NotSuccess
=
true
dataCoord
.
DropVirtualChannel
Status
=
commonpb
.
ErrorCode_UnexpectedError
assert
.
Panics
(
t
,
func
()
{
dropFunc
(
nil
)
})
...
...
@@ -631,11 +641,21 @@ func TestDropVirtualChannelFunc(t *testing.T) {
t
.
Run
(
"datacoord call error"
,
func
(
t
*
testing
.
T
)
{
dataCoord
.
DropVirtualChannel
NotSuccess
=
false
dataCoord
.
DropVirtualChannel
Status
=
commonpb
.
ErrorCode_UnexpectedError
dataCoord
.
DropVirtualChannelError
=
true
assert
.
Panics
(
t
,
func
()
{
dropFunc
(
nil
)
})
})
// issue https://github.com/milvus-io/milvus/issues/17097
// meta error, datanode shall not panic, just drop the virtual channel
t
.
Run
(
"datacoord found meta error"
,
func
(
t
*
testing
.
T
)
{
dataCoord
.
DropVirtualChannelStatus
=
commonpb
.
ErrorCode_MetaFailed
dataCoord
.
DropVirtualChannelError
=
false
assert
.
NotPanics
(
t
,
func
()
{
dropFunc
(
nil
)
})
})
}
internal/datanode/mock_test.go
浏览文件 @
55f1e03c
...
...
@@ -164,14 +164,14 @@ type RootCoordFactory struct {
type
DataCoordFactory
struct
{
types
.
DataCoord
SaveBinlogPathError
bool
SaveBinlogPath
NotSuccess
bool
SaveBinlogPathError
bool
SaveBinlogPath
Status
commonpb
.
ErrorCode
CompleteCompactionError
bool
CompleteCompactionNotSuccess
bool
DropVirtualChannelError
bool
DropVirtualChannel
NotSuccess
bool
DropVirtualChannelError
bool
DropVirtualChannel
Status
commonpb
.
ErrorCode
}
func
(
ds
*
DataCoordFactory
)
AssignSegmentID
(
ctx
context
.
Context
,
req
*
datapb
.
AssignSegmentIDRequest
)
(
*
datapb
.
AssignSegmentIDResponse
,
error
)
{
...
...
@@ -202,27 +202,16 @@ func (ds *DataCoordFactory) SaveBinlogPaths(ctx context.Context, req *datapb.Sav
if
ds
.
SaveBinlogPathError
{
return
nil
,
errors
.
New
(
"Error"
)
}
if
ds
.
SaveBinlogPathNotSuccess
{
return
&
commonpb
.
Status
{
ErrorCode
:
commonpb
.
ErrorCode_UnexpectedError
},
nil
}
return
&
commonpb
.
Status
{
ErrorCode
:
commonpb
.
ErrorCode_Success
},
nil
return
&
commonpb
.
Status
{
ErrorCode
:
ds
.
SaveBinlogPathStatus
},
nil
}
func
(
ds
*
DataCoordFactory
)
DropVirtualChannel
(
ctx
context
.
Context
,
req
*
datapb
.
DropVirtualChannelRequest
)
(
*
datapb
.
DropVirtualChannelResponse
,
error
)
{
if
ds
.
DropVirtualChannelError
{
return
nil
,
errors
.
New
(
"error"
)
}
if
ds
.
DropVirtualChannelNotSuccess
{
return
&
datapb
.
DropVirtualChannelResponse
{
Status
:
&
commonpb
.
Status
{
ErrorCode
:
commonpb
.
ErrorCode_UnexpectedError
,
},
},
nil
}
return
&
datapb
.
DropVirtualChannelResponse
{
Status
:
&
commonpb
.
Status
{
ErrorCode
:
commonpb
.
ErrorCode_Succes
s
,
ErrorCode
:
ds
.
DropVirtualChannelStatu
s
,
},
},
nil
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录