Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
5d586063
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,发现更多精彩内容 >>
提交
5d586063
编写于
12月 24, 2020
作者:
S
sunby
提交者:
yefu.chen
12月 24, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move Status to SegIDAssignment
Signed-off-by:
N
sunby
<
bingyi.sun@zilliz.com
>
上级
a8b78f11
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
166 addition
and
156 deletion
+166
-156
internal/allocator/segment.go
internal/allocator/segment.go
+4
-6
internal/master/grpc_service.go
internal/master/grpc_service.go
+1
-10
internal/master/segment_manager.go
internal/master/segment_manager.go
+25
-4
internal/master/segment_manager_test.go
internal/master/segment_manager_test.go
+4
-4
internal/proto/internal_msg.proto
internal/proto/internal_msg.proto
+2
-2
internal/proto/internalpb/internal_msg.pb.go
internal/proto/internalpb/internal_msg.pb.go
+130
-130
未找到文件。
internal/allocator/segment.go
浏览文件 @
5d586063
...
...
@@ -10,8 +10,6 @@ import (
"github.com/cznic/mathutil"
"github.com/zilliztech/milvus-distributed/internal/proto/commonpb"
"github.com/zilliztech/milvus-distributed/internal/errors"
"github.com/zilliztech/milvus-distributed/internal/proto/internalpb"
)
...
...
@@ -174,10 +172,10 @@ func (sa *SegIDAssigner) syncSegments() {
fmt
.
Println
(
"OOOOO"
,
req
.
PerChannelReq
)
resp
,
err
:=
sa
.
masterClient
.
AssignSegmentID
(
ctx
,
req
)
if
resp
.
Status
.
GetErrorCode
()
!=
commonpb
.
ErrorCode_SUCCESS
{
log
.
Println
(
"GRPC AssignSegmentID Failed"
,
resp
,
err
)
return
}
//
if resp.Status.GetErrorCode() != commonpb.ErrorCode_SUCCESS {
//
log.Println("GRPC AssignSegmentID Failed", resp, err)
//
return
//
}
now
:=
time
.
Now
()
expiredTime
:=
now
.
Add
(
time
.
Millisecond
*
time
.
Duration
(
1000
))
...
...
internal/master/grpc_service.go
浏览文件 @
5d586063
...
...
@@ -437,17 +437,8 @@ func (s *Master) AllocID(ctx context.Context, request *internalpb.IDRequest) (*i
}
func
(
s
*
Master
)
AssignSegmentID
(
ctx
context
.
Context
,
request
*
internalpb
.
AssignSegIDRequest
)
(
*
internalpb
.
AssignSegIDResponse
,
error
)
{
segInfos
,
err
:=
s
.
segmentManager
.
AssignSegment
(
request
.
GetPerChannelReq
())
if
err
!=
nil
{
return
&
internalpb
.
AssignSegIDResponse
{
Status
:
&
commonpb
.
Status
{
ErrorCode
:
commonpb
.
ErrorCode_UNEXPECTED_ERROR
},
},
nil
}
segInfos
,
_
:=
s
.
segmentManager
.
AssignSegment
(
request
.
GetPerChannelReq
())
return
&
internalpb
.
AssignSegIDResponse
{
Status
:
&
commonpb
.
Status
{
ErrorCode
:
commonpb
.
ErrorCode_SUCCESS
,
Reason
:
""
,
},
PerChannelAssignment
:
segInfos
,
},
nil
}
...
...
internal/master/segment_manager.go
浏览文件 @
5d586063
...
...
@@ -3,8 +3,11 @@ package master
import
(
"context"
"log"
"strconv"
"sync"
"github.com/zilliztech/milvus-distributed/internal/proto/commonpb"
"github.com/zilliztech/milvus-distributed/internal/util/typeutil"
"github.com/zilliztech/milvus-distributed/internal/proto/etcdpb"
...
...
@@ -58,6 +61,11 @@ func (manager *SegmentManager) AssignSegment(segIDReq []*internalpb.SegIDRequest
res
:=
make
([]
*
internalpb
.
SegIDAssignment
,
0
)
for
_
,
req
:=
range
segIDReq
{
result
:=
&
internalpb
.
SegIDAssignment
{
Status
:
&
commonpb
.
Status
{
ErrorCode
:
commonpb
.
ErrorCode_UNEXPECTED_ERROR
,
},
}
collName
:=
req
.
CollName
partitionTag
:=
req
.
PartitionTag
count
:=
req
.
Count
...
...
@@ -65,22 +73,27 @@ func (manager *SegmentManager) AssignSegment(segIDReq []*internalpb.SegIDRequest
collMeta
,
err
:=
manager
.
metaTable
.
GetCollectionByName
(
collName
)
if
err
!=
nil
{
return
nil
,
err
result
.
Status
.
Reason
=
err
.
Error
()
res
=
append
(
res
,
result
)
continue
}
collID
:=
collMeta
.
GetID
()
if
!
manager
.
metaTable
.
HasPartition
(
collID
,
partitionTag
)
{
return
nil
,
errors
.
Errorf
(
"partition tag %s can not find in coll %d"
,
partitionTag
,
collID
)
result
.
Status
.
Reason
=
"partition tag "
+
partitionTag
+
" can not find in coll "
+
strconv
.
FormatInt
(
collID
,
10
)
res
=
append
(
res
,
result
)
continue
}
assignInfo
,
err
:=
manager
.
assignSegment
(
collName
,
collID
,
partitionTag
,
count
,
channelID
)
if
err
!=
nil
{
return
nil
,
err
result
.
Status
.
Reason
=
err
.
Error
()
res
=
append
(
res
,
result
)
continue
}
res
=
append
(
res
,
assignInfo
)
}
return
res
,
nil
}
...
...
@@ -125,6 +138,10 @@ func (manager *SegmentManager) assignSegment(
CollName
:
collName
,
PartitionTag
:
partitionTag
,
ExpireTime
:
result
.
expireTime
,
Status
:
&
commonpb
.
Status
{
ErrorCode
:
commonpb
.
ErrorCode_SUCCESS
,
Reason
:
""
,
},
},
nil
}
...
...
@@ -156,6 +173,10 @@ func (manager *SegmentManager) assignSegment(
CollName
:
collName
,
PartitionTag
:
partitionTag
,
ExpireTime
:
result
.
expireTime
,
Status
:
&
commonpb
.
Status
{
ErrorCode
:
commonpb
.
ErrorCode_SUCCESS
,
Reason
:
""
,
},
},
nil
}
...
...
internal/master/segment_manager_test.go
浏览文件 @
5d586063
...
...
@@ -112,13 +112,13 @@ func TestSegmentManager_AssignSegment(t *testing.T) {
var
results
=
make
([]
*
internalpb
.
SegIDAssignment
,
0
)
for
_
,
c
:=
range
cases
{
result
,
err
:=
segManager
.
AssignSegment
([]
*
internalpb
.
SegIDRequest
{{
Count
:
c
.
Count
,
ChannelID
:
c
.
ChannelID
,
CollName
:
collName
,
PartitionTag
:
partitionTag
}})
result
,
_
:=
segManager
.
AssignSegment
([]
*
internalpb
.
SegIDRequest
{{
Count
:
c
.
Count
,
ChannelID
:
c
.
ChannelID
,
CollName
:
collName
,
PartitionTag
:
partitionTag
}})
results
=
append
(
results
,
result
...
)
if
c
.
Err
{
assert
.
NotNil
(
t
,
err
)
assert
.
EqualValues
(
t
,
commonpb
.
ErrorCode_UNEXPECTED_ERROR
,
result
[
0
]
.
Status
.
ErrorCode
)
continue
}
assert
.
Nil
(
t
,
err
)
assert
.
EqualValues
(
t
,
commonpb
.
ErrorCode_SUCCESS
,
result
[
0
]
.
Status
.
ErrorCode
)
if
c
.
SameIDWith
!=
-
1
{
assert
.
EqualValues
(
t
,
result
[
0
]
.
SegID
,
results
[
c
.
SameIDWith
]
.
SegID
)
}
...
...
@@ -257,9 +257,9 @@ func TestSegmentManager_RPC(t *testing.T) {
},
})
assert
.
Nil
(
t
,
err
)
assert
.
EqualValues
(
t
,
commonpb
.
ErrorCode_SUCCESS
,
resp
.
Status
.
ErrorCode
)
assignments
:=
resp
.
GetPerChannelAssignment
()
assert
.
EqualValues
(
t
,
1
,
len
(
assignments
))
assert
.
EqualValues
(
t
,
commonpb
.
ErrorCode_SUCCESS
,
assignments
[
0
]
.
Status
.
ErrorCode
)
assert
.
EqualValues
(
t
,
collName
,
assignments
[
0
]
.
CollName
)
assert
.
EqualValues
(
t
,
partitionTag
,
assignments
[
0
]
.
PartitionTag
)
assert
.
EqualValues
(
t
,
int32
(
0
),
assignments
[
0
]
.
ChannelID
)
...
...
internal/proto/internal_msg.proto
浏览文件 @
5d586063
...
...
@@ -100,11 +100,11 @@ message SegIDAssignment {
string
coll_name
=
4
;
string
partition_tag
=
5
;
uint64
expire_time
=
6
;
common.Status
status
=
7
;
}
message
AssignSegIDResponse
{
common.Status
status
=
1
;
repeated
SegIDAssignment
per_channel_assignment
=
2
;
repeated
SegIDAssignment
per_channel_assignment
=
1
;
}
message
CreateCollectionRequest
{
...
...
internal/proto/internalpb/internal_msg.pb.go
浏览文件 @
5d586063
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录