Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
c983af85
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,发现更多精彩内容 >>
未验证
提交
c983af85
编写于
12月 17, 2021
作者:
G
godchen
提交者:
GitHub
12月 17, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[skip e2e]Fix policy typo (#13645)
Signed-off-by:
N
godchen0212
<
qingxiang.chen@zilliz.com
>
上级
cb570a5a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
21 addition
and
21 deletion
+21
-21
internal/datacoord/policy.go
internal/datacoord/policy.go
+21
-21
未找到文件。
internal/datacoord/policy.go
浏览文件 @
c983af85
...
...
@@ -108,11 +108,11 @@ func filterNode(infos []*NodeChannelInfo, nodeID int64) []*NodeChannelInfo {
return
filtered
}
// ConsistentHashRegisterPolicy use a consistent hash to matain the mapping
func
ConsistentHashRegisterPolicy
(
hash
r
ing
*
consistent
.
Consistent
)
RegisterPolicy
{
// ConsistentHashRegisterPolicy use a consistent hash to ma
in
tain the mapping
func
ConsistentHashRegisterPolicy
(
hash
R
ing
*
consistent
.
Consistent
)
RegisterPolicy
{
return
func
(
store
ROChannelStore
,
nodeID
int64
)
ChannelOpSet
{
elems
:=
formatNodeIDs
(
store
.
GetNodes
())
hash
r
ing
.
Set
(
elems
)
hash
R
ing
.
Set
(
elems
)
removes
:=
make
(
map
[
int64
][]
*
channel
)
adds
:=
make
(
map
[
int64
][]
*
channel
)
...
...
@@ -129,13 +129,13 @@ func ConsistentHashRegisterPolicy(hashring *consistent.Consistent) RegisterPolic
channelsInfo
:=
store
.
GetNodesChannels
()
for
_
,
c
:=
range
channelsInfo
{
for
_
,
ch
:=
range
c
.
Channels
{
id
str
,
err
:=
hashr
ing
.
Get
(
ch
.
Name
)
id
Str
,
err
:=
hashR
ing
.
Get
(
ch
.
Name
)
if
err
!=
nil
{
log
.
Warn
(
"receive error when getting from hash
r
ing"
,
log
.
Warn
(
"receive error when getting from hash
R
ing"
,
zap
.
String
(
"channel"
,
ch
.
Name
),
zap
.
Error
(
err
))
return
nil
}
did
,
err
:=
deformatNodeID
(
id
s
tr
)
did
,
err
:=
deformatNodeID
(
id
S
tr
)
if
err
!=
nil
{
log
.
Warn
(
"failed to deformat node id"
,
zap
.
Int64
(
"nodeID"
,
did
))
return
nil
...
...
@@ -202,16 +202,16 @@ func AverageAssignPolicy(store ROChannelStore, channels []*channel) ChannelOpSet
}
// ConsistentHashChannelAssignPolicy use a consistent hash algorithm to determine channel assignment
func
ConsistentHashChannelAssignPolicy
(
hash
r
ing
*
consistent
.
Consistent
)
ChannelAssignPolicy
{
func
ConsistentHashChannelAssignPolicy
(
hash
R
ing
*
consistent
.
Consistent
)
ChannelAssignPolicy
{
return
func
(
store
ROChannelStore
,
channels
[]
*
channel
)
ChannelOpSet
{
hash
r
ing
.
Set
(
formatNodeIDs
(
store
.
GetNodes
()))
hash
R
ing
.
Set
(
formatNodeIDs
(
store
.
GetNodes
()))
filteredChannels
:=
filterChannels
(
store
,
channels
)
if
len
(
filteredChannels
)
==
0
{
return
nil
}
if
len
(
hash
r
ing
.
Members
())
==
0
{
if
len
(
hash
R
ing
.
Members
())
==
0
{
opSet
:=
ChannelOpSet
{}
opSet
.
Add
(
bufferID
,
channels
)
return
opSet
...
...
@@ -219,13 +219,13 @@ func ConsistentHashChannelAssignPolicy(hashring *consistent.Consistent) ChannelA
adds
:=
make
(
map
[
int64
][]
*
channel
)
for
_
,
c
:=
range
filteredChannels
{
id
str
,
err
:=
hashr
ing
.
Get
(
c
.
Name
)
id
Str
,
err
:=
hashR
ing
.
Get
(
c
.
Name
)
if
err
!=
nil
{
log
.
Warn
(
"receive error when getting from hash
r
ing"
,
log
.
Warn
(
"receive error when getting from hash
R
ing"
,
zap
.
String
(
"channel"
,
c
.
Name
),
zap
.
Error
(
err
))
return
nil
}
did
,
err
:=
deformatNodeID
(
id
s
tr
)
did
,
err
:=
deformatNodeID
(
id
S
tr
)
if
err
!=
nil
{
log
.
Warn
(
"failed to deformat node id"
,
zap
.
Int64
(
"nodeID"
,
did
))
return
nil
...
...
@@ -316,9 +316,9 @@ func AvgAssignUnregisteredChannels(store ROChannelStore, nodeID int64) ChannelOp
}
// ConsistentHashDeregisterPolicy return a DeregisterPolicy that uses consistent hash
func
ConsistentHashDeregisterPolicy
(
hash
r
ing
*
consistent
.
Consistent
)
DeregisterPolicy
{
func
ConsistentHashDeregisterPolicy
(
hash
R
ing
*
consistent
.
Consistent
)
DeregisterPolicy
{
return
func
(
store
ROChannelStore
,
nodeID
int64
)
ChannelOpSet
{
hash
r
ing
.
Set
(
formatNodeIDsWithFilter
(
store
.
GetNodes
(),
nodeID
))
hash
R
ing
.
Set
(
formatNodeIDsWithFilter
(
store
.
GetNodes
(),
nodeID
))
channels
:=
store
.
GetNodesChannels
()
opSet
:=
ChannelOpSet
{}
var
deletedInfo
*
NodeChannelInfo
...
...
@@ -337,7 +337,7 @@ func ConsistentHashDeregisterPolicy(hashring *consistent.Consistent) DeregisterP
opSet
.
Delete
(
nodeID
,
deletedInfo
.
Channels
)
// If no members in hash ring, store channels in buffer
if
len
(
hash
r
ing
.
Members
())
==
0
{
if
len
(
hash
R
ing
.
Members
())
==
0
{
opSet
.
Add
(
bufferID
,
deletedInfo
.
Channels
)
return
opSet
}
...
...
@@ -345,15 +345,15 @@ func ConsistentHashDeregisterPolicy(hashring *consistent.Consistent) DeregisterP
// reassign channels of deleted node
updates
:=
make
(
map
[
int64
][]
*
channel
)
for
_
,
c
:=
range
deletedInfo
.
Channels
{
id
str
,
err
:=
hashr
ing
.
Get
(
c
.
Name
)
id
Str
,
err
:=
hashR
ing
.
Get
(
c
.
Name
)
if
err
!=
nil
{
log
.
Warn
(
"failed to get channel in hash ring"
,
zap
.
String
(
"channel"
,
c
.
Name
))
return
nil
}
did
,
err
:=
deformatNodeID
(
id
s
tr
)
did
,
err
:=
deformatNodeID
(
id
S
tr
)
if
err
!=
nil
{
log
.
Warn
(
"failed to deformat id"
,
zap
.
String
(
"id"
,
id
s
tr
))
log
.
Warn
(
"failed to deformat id"
,
zap
.
String
(
"id"
,
id
S
tr
))
}
updates
[
did
]
=
append
(
updates
[
did
],
c
)
...
...
@@ -437,7 +437,7 @@ func EmptyBgChecker(channels []*NodeChannelInfo, ts time.Time) ([]*NodeChannelIn
// BgCheckWithMaxWatchDuration returns a ChannelBGChecker with the maxWatchDuration
func
BgCheckWithMaxWatchDuration
(
kv
kv
.
TxnKV
)
ChannelBGChecker
{
return
func
(
channels
[]
*
NodeChannelInfo
,
ts
time
.
Time
)
([]
*
NodeChannelInfo
,
error
)
{
re
a
llocations
:=
make
([]
*
NodeChannelInfo
,
0
,
len
(
channels
))
re
A
llocations
:=
make
([]
*
NodeChannelInfo
,
0
,
len
(
channels
))
for
_
,
ch
:=
range
channels
{
cinfo
:=
&
NodeChannelInfo
{
NodeID
:
ch
.
NodeID
,
...
...
@@ -465,10 +465,10 @@ func BgCheckWithMaxWatchDuration(kv kv.TxnKV) ChannelBGChecker {
}
}
if
len
(
cinfo
.
Channels
)
!=
0
{
re
allocations
=
append
(
rea
llocations
,
cinfo
)
re
Allocations
=
append
(
reA
llocations
,
cinfo
)
}
}
return
re
a
llocations
,
nil
return
re
A
llocations
,
nil
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录