Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
fd0227b6
M
milvus
项目概览
milvus
/
milvus
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
fd0227b6
编写于
1月 26, 2021
作者:
N
neza2017
提交者:
yefu.chen
1月 26, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add logic of get time tick
Signed-off-by:
N
neza2017
<
yefu.chen@zilliz.com
>
上级
3b081620
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
43 addition
and
16 deletion
+43
-16
cmd/masterservice/main.go
cmd/masterservice/main.go
+23
-6
internal/distributed/proxyservice/client.go
internal/distributed/proxyservice/client.go
+16
-0
internal/masterservice/master_service.go
internal/masterservice/master_service.go
+2
-5
internal/masterservice/master_service_test.go
internal/masterservice/master_service_test.go
+2
-5
未找到文件。
cmd/masterservice/main.go
浏览文件 @
fd0227b6
...
...
@@ -31,15 +31,31 @@ func main() {
}
log
.
Printf
(
"master service address : %s:%d"
,
ms
.
Params
.
Address
,
ms
.
Params
.
Port
)
cnt
:=
0
psc
.
Params
.
Init
()
log
.
Printf
(
"proxy service address : %s"
,
psc
.
Params
.
NetworkAddress
())
//proxyService := psc.NewClient(ctx,
psc.Params.NetworkAddress())
proxyService
:=
psc
.
NewClient
(
psc
.
Params
.
NetworkAddress
())
//TODO, test proxy service GetComponentStates, before set
for
cnt
=
0
;
cnt
<
reTryCnt
;
cnt
++
{
pxStates
,
err
:=
proxyService
.
GetComponentStates
()
if
err
!=
nil
{
log
.
Printf
(
"get state from proxy service, retry count = %d, error = %s"
,
cnt
,
err
.
Error
())
continue
}
if
pxStates
.
Status
.
ErrorCode
!=
commonpb
.
ErrorCode_SUCCESS
{
log
.
Printf
(
"get state from proxy service, retry count = %d, error = %s"
,
cnt
,
pxStates
.
Status
.
Reason
)
continue
}
if
pxStates
.
State
.
StateCode
!=
internalpb2
.
StateCode_INITIALIZING
&&
pxStates
.
State
.
StateCode
!=
internalpb2
.
StateCode_HEALTHY
{
continue
}
break
}
//
if err = svr.SetProxyService(proxyService); err != nil {
//
panic(err)
//
}
if
err
=
svr
.
SetProxyService
(
proxyService
);
err
!=
nil
{
panic
(
err
)
}
ds
.
Params
.
Init
()
log
.
Printf
(
"data service address : %s:%d"
,
ds
.
Params
.
Address
,
ds
.
Params
.
Port
)
...
...
@@ -50,7 +66,6 @@ func main() {
if
err
=
dataService
.
Start
();
err
!=
nil
{
panic
(
err
)
}
cnt
:=
0
for
cnt
=
0
;
cnt
<
reTryCnt
;
cnt
++
{
dsStates
,
err
:=
dataService
.
GetComponentStates
()
if
err
!=
nil
{
...
...
@@ -93,5 +108,7 @@ func main() {
syscall
.
SIGQUIT
)
sig
:=
<-
sc
log
.
Printf
(
"Got %s signal to exit"
,
sig
.
String
())
_
=
indexService
.
Stop
()
_
=
dataService
.
Stop
()
_
=
svr
.
Stop
()
}
internal/distributed/proxyservice/client.go
浏览文件 @
fd0227b6
...
...
@@ -3,6 +3,10 @@ package grpcproxyservice
import
(
"context"
"github.com/zilliztech/milvus-distributed/internal/proto/internalpb2"
"github.com/zilliztech/milvus-distributed/internal/proto/commonpb"
"google.golang.org/grpc"
"github.com/zilliztech/milvus-distributed/internal/proto/proxypb"
...
...
@@ -44,6 +48,18 @@ func (c *Client) InvalidateCollectionMetaCache(request *proxypb.InvalidateCollMe
return
err
}
func
(
c
*
Client
)
GetTimeTickChannel
()
(
string
,
error
)
{
response
,
err
:=
c
.
proxyServiceClient
.
GetTimeTickChannel
(
c
.
ctx
,
&
commonpb
.
Empty
{})
if
err
!=
nil
{
return
""
,
err
}
return
response
.
Value
,
nil
}
func
(
c
*
Client
)
GetComponentStates
()
(
*
internalpb2
.
ComponentStates
,
error
)
{
return
c
.
proxyServiceClient
.
GetComponentStates
(
c
.
ctx
,
&
commonpb
.
Empty
{})
}
func
NewClient
(
address
string
)
*
Client
{
return
&
Client
{
address
:
address
,
...
...
internal/masterservice/master_service.go
浏览文件 @
fd0227b6
...
...
@@ -37,7 +37,7 @@ import (
type
ProxyServiceInterface
interface
{
GetTimeTickChannel
()
(
string
,
error
)
InvalidateCollectionMetaCache
(
request
*
proxypb
.
InvalidateCollMetaCacheRequest
)
(
*
commonpb
.
Status
,
error
)
InvalidateCollectionMetaCache
(
request
*
proxypb
.
InvalidateCollMetaCacheRequest
)
error
}
type
DataServiceInterface
interface
{
...
...
@@ -582,7 +582,7 @@ func (c *Core) SetProxyService(s ProxyServiceInterface) error {
Params
.
ProxyTimeTickChannel
=
rsp
c
.
InvalidateCollectionMetaCache
=
func
(
ts
typeutil
.
Timestamp
,
dbName
string
,
collectionName
string
)
error
{
status
,
err
:=
s
.
InvalidateCollectionMetaCache
(
&
proxypb
.
InvalidateCollMetaCacheRequest
{
err
:=
s
.
InvalidateCollectionMetaCache
(
&
proxypb
.
InvalidateCollMetaCacheRequest
{
Base
:
&
commonpb
.
MsgBase
{
MsgType
:
0
,
//TODO,MsgType
MsgID
:
0
,
...
...
@@ -595,9 +595,6 @@ func (c *Core) SetProxyService(s ProxyServiceInterface) error {
if
err
!=
nil
{
return
err
}
if
status
.
ErrorCode
!=
commonpb
.
ErrorCode_SUCCESS
{
return
errors
.
Errorf
(
"InvalidateCollectionMetaCache failed, error = %s"
,
status
.
Reason
)
}
return
nil
}
return
nil
...
...
internal/masterservice/master_service_test.go
浏览文件 @
fd0227b6
...
...
@@ -32,14 +32,11 @@ type proxyMock struct {
func
(
p
*
proxyMock
)
GetTimeTickChannel
()
(
string
,
error
)
{
return
fmt
.
Sprintf
(
"proxy-time-tick-%d"
,
p
.
randVal
),
nil
}
func
(
p
*
proxyMock
)
InvalidateCollectionMetaCache
(
request
*
proxypb
.
InvalidateCollMetaCacheRequest
)
(
*
commonpb
.
Status
,
error
)
{
func
(
p
*
proxyMock
)
InvalidateCollectionMetaCache
(
request
*
proxypb
.
InvalidateCollMetaCacheRequest
)
error
{
p
.
mutex
.
Lock
()
defer
p
.
mutex
.
Unlock
()
p
.
collArray
=
append
(
p
.
collArray
,
request
.
CollectionName
)
return
&
commonpb
.
Status
{
ErrorCode
:
commonpb
.
ErrorCode_SUCCESS
,
Reason
:
""
,
},
nil
return
nil
}
func
(
p
*
proxyMock
)
GetCollArray
()
[]
string
{
p
.
mutex
.
Lock
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录