Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
227889b0
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 搜索 >>
未验证
提交
227889b0
编写于
3月 25, 2022
作者:
Y
yah01
提交者:
GitHub
3月 25, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add replica interfaces for Meta and Cluster (#16190)
Signed-off-by:
N
yah01
<
yang.cen@zilliz.com
>
上级
f4ebd3a9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
66 addition
and
0 deletion
+66
-0
internal/querycoord/cluster.go
internal/querycoord/cluster.go
+13
-0
internal/querycoord/meta.go
internal/querycoord/meta.go
+53
-0
未找到文件。
internal/querycoord/cluster.go
浏览文件 @
227889b0
...
...
@@ -75,6 +75,9 @@ type Cluster interface {
allocateSegmentsToQueryNode
(
ctx
context
.
Context
,
reqs
[]
*
querypb
.
LoadSegmentsRequest
,
wait
bool
,
excludeNodeIDs
[]
int64
,
includeNodeIDs
[]
int64
)
error
allocateChannelsToQueryNode
(
ctx
context
.
Context
,
reqs
[]
*
querypb
.
WatchDmChannelsRequest
,
wait
bool
,
excludeNodeIDs
[]
int64
)
error
assignNodesToReplicas
(
ctx
context
.
Context
,
reqs
[]
*
querypb
.
LoadSegmentsRequest
,
replicaIds
[]
int64
)
error
assignSegmentsToReplica
(
ctx
context
.
Context
,
reqs
[]
*
querypb
.
LoadSegmentsRequest
,
replicaID
int64
,
wait
bool
)
error
getSessionVersion
()
int64
getMetrics
(
ctx
context
.
Context
,
in
*
milvuspb
.
GetMetricsRequest
)
[]
queryNodeGetMetricsResponse
...
...
@@ -700,3 +703,13 @@ func (c *queryNodeCluster) allocateSegmentsToQueryNode(ctx context.Context, reqs
func
(
c
*
queryNodeCluster
)
allocateChannelsToQueryNode
(
ctx
context
.
Context
,
reqs
[]
*
querypb
.
WatchDmChannelsRequest
,
wait
bool
,
excludeNodeIDs
[]
int64
)
error
{
return
c
.
channelAllocator
(
ctx
,
reqs
,
c
,
c
.
clusterMeta
,
wait
,
excludeNodeIDs
)
}
func
(
c
*
queryNodeCluster
)
assignNodesToReplicas
(
ctx
context
.
Context
,
reqs
[]
*
querypb
.
LoadSegmentsRequest
,
replicaIds
[]
int64
)
error
{
// todo(yah01)
return
nil
}
func
(
c
*
queryNodeCluster
)
assignSegmentsToReplica
(
ctx
context
.
Context
,
reqs
[]
*
querypb
.
LoadSegmentsRequest
,
replicaID
int64
,
wait
bool
)
error
{
// todo(yah01)
return
nil
}
internal/querycoord/meta.go
浏览文件 @
227889b0
...
...
@@ -90,6 +90,11 @@ type Meta interface {
sendSealedSegmentChangeInfos
(
collectionID
UniqueID
,
queryChannel
string
,
changeInfos
*
querypb
.
SealedSegmentsChangeInfo
)
(
*
internalpb
.
MsgPosition
,
error
)
getWatchedChannelsByNodeID
(
nodeID
int64
)
*
querypb
.
UnsubscribeChannelInfo
addReplica
(
replicaNum
int32
,
collectionID
int64
,
partitionIds
[]
int64
)
error
setReplicaInfo
(
replicaID
int64
,
info
*
querypb
.
ReplicaInfo
)
error
getReplicaByID
(
replicaID
int64
)
(
*
querypb
.
ReplicaInfo
,
error
)
getReplicasByNodeID
(
nodeID
int64
,
collectionID
int64
)
(
*
querypb
.
ReplicaInfo
,
error
)
}
// MetaReplica records the current load information on all querynodes
...
...
@@ -114,6 +119,7 @@ type MetaReplica struct {
segmentsInfo
*
segmentsInfo
//partitionStates map[UniqueID]*querypb.PartitionStates
// replicas *ReplicaInfos
}
func
newMeta
(
ctx
context
.
Context
,
kv
kv
.
MetaKv
,
factory
msgstream
.
Factory
,
idAllocator
func
()
(
UniqueID
,
error
))
(
Meta
,
error
)
{
...
...
@@ -138,6 +144,7 @@ func newMeta(ctx context.Context, kv kv.MetaKv, factory msgstream.Factory, idAll
queryStreams
:
queryMsgStream
,
segmentsInfo
:
newSegmentsInfo
(
kv
),
// replicas: NewReplicaInfos(),
}
err
:=
m
.
reloadFromKV
()
...
...
@@ -1014,6 +1021,52 @@ func (m *MetaReplica) getWatchedChannelsByNodeID(nodeID int64) *querypb.Unsubscr
return
unsubscribeChannelInfo
}
func
(
m
*
MetaReplica
)
addReplica
(
replicaNum
int32
,
collectionID
int64
,
partitionIds
[]
int64
)
error
{
// collection, err := meta.getCollectionInfoByID(collectionId)
// if err != nil {
// return err
// }
// replicas := make([]*querypb.ReplicaInfo, 0, replicaNum)
// for i := 0; i < int(replicaNum); i++ {
// replicaId, err := meta.idAllocator()
// if err != nil {
// return err
// }
// replicas = append(replicas, &querypb.ReplicaInfo{
// ReplicaId: replicaId,
// CollectionId: collectionId,
// PartitionIds: partitionIds,
// ShardReplicas: make([]*querypb.ShardReplica, 0),
// })
// }
// for _, replica := range replicas {
// meta.replicas.Insert(replica.ReplicaId, replica)
// }
return
nil
// todo(yah01)
}
func
(
m
*
MetaReplica
)
setReplicaInfo
(
replicaID
int64
,
info
*
querypb
.
ReplicaInfo
)
error
{
return
nil
// todo(yah01)
}
func
(
m
*
MetaReplica
)
getReplicaByID
(
replicaID
int64
)
(
*
querypb
.
ReplicaInfo
,
error
)
{
return
nil
,
nil
// todo(yah01)
// return meta.replicas.Get(replicaID)
}
func
(
m
*
MetaReplica
)
getReplicasByNodeID
(
nodeID
int64
,
collectionID
int64
)
(
*
querypb
.
ReplicaInfo
,
error
)
{
return
nil
,
nil
// todo(yah01)
}
//func (m *MetaReplica) printMeta() {
// m.RLock()
// defer m.RUnlock()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录