Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
1b1d4e50
M
milvus
项目概览
milvus
/
milvus
9 个月 前同步成功
通知
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 搜索 >>
未验证
提交
1b1d4e50
编写于
1月 18, 2022
作者:
C
Cai Yudong
提交者:
GitHub
1月 18, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove session from timetickSync (#15255)
Signed-off-by:
N
yudong.cai
<
yudong.cai@zilliz.com
>
上级
ac3e30db
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
14 addition
and
18 deletion
+14
-18
internal/rootcoord/root_coord.go
internal/rootcoord/root_coord.go
+2
-2
internal/rootcoord/timeticksync.go
internal/rootcoord/timeticksync.go
+9
-9
internal/rootcoord/timeticksync_test.go
internal/rootcoord/timeticksync_test.go
+3
-7
未找到文件。
internal/rootcoord/root_coord.go
浏览文件 @
1b1d4e50
...
@@ -1032,7 +1032,7 @@ func (c *Core) Init() error {
...
@@ -1032,7 +1032,7 @@ func (c *Core) Init() error {
}
}
chanMap
:=
c
.
MetaTable
.
ListCollectionPhysicalChannels
()
chanMap
:=
c
.
MetaTable
.
ListCollectionPhysicalChannels
()
c
.
chanTimeTick
=
newTimeTickSync
(
c
.
ctx
,
c
.
session
,
c
.
msFactory
,
chanMap
)
c
.
chanTimeTick
=
newTimeTickSync
(
c
.
ctx
,
c
.
session
.
ServerID
,
c
.
msFactory
,
chanMap
)
c
.
chanTimeTick
.
addProxy
(
c
.
session
)
c
.
chanTimeTick
.
addProxy
(
c
.
session
)
c
.
proxyClientManager
=
newProxyClientManager
(
c
)
c
.
proxyClientManager
=
newProxyClientManager
(
c
)
...
@@ -1040,7 +1040,7 @@ func (c *Core) Init() error {
...
@@ -1040,7 +1040,7 @@ func (c *Core) Init() error {
c
.
proxyManager
=
newProxyManager
(
c
.
proxyManager
=
newProxyManager
(
c
.
ctx
,
c
.
ctx
,
c
.
etcdCli
,
c
.
etcdCli
,
c
.
chanTimeTick
.
get
Proxy
,
c
.
chanTimeTick
.
clear
Proxy
,
c
.
proxyClientManager
.
GetProxyClients
,
c
.
proxyClientManager
.
GetProxyClients
,
)
)
c
.
proxyManager
.
AddSession
(
c
.
chanTimeTick
.
addProxy
,
c
.
proxyClientManager
.
AddProxyClient
)
c
.
proxyManager
.
AddSession
(
c
.
chanTimeTick
.
addProxy
,
c
.
proxyClientManager
.
AddProxyClient
)
...
...
internal/rootcoord/timeticksync.go
浏览文件 @
1b1d4e50
...
@@ -44,8 +44,8 @@ var (
...
@@ -44,8 +44,8 @@ var (
)
)
type
timetickSync
struct
{
type
timetickSync
struct
{
ctx
context
.
Context
ctx
context
.
Context
s
ession
*
sessionutil
.
Session
s
ourceID
int64
dmlChannels
*
dmlChannels
// used for insert
dmlChannels
*
dmlChannels
// used for insert
deltaChannels
*
dmlChannels
// used for delete
deltaChannels
*
dmlChannels
// used for delete
...
@@ -85,7 +85,7 @@ func (c *chanTsMsg) getTimetick(channelName string) typeutil.Timestamp {
...
@@ -85,7 +85,7 @@ func (c *chanTsMsg) getTimetick(channelName string) typeutil.Timestamp {
return
c
.
defaultTs
return
c
.
defaultTs
}
}
func
newTimeTickSync
(
ctx
context
.
Context
,
s
ession
*
sessionutil
.
Session
,
factory
msgstream
.
Factory
,
chanMap
map
[
typeutil
.
UniqueID
][]
string
)
*
timetickSync
{
func
newTimeTickSync
(
ctx
context
.
Context
,
s
ourceID
int64
,
factory
msgstream
.
Factory
,
chanMap
map
[
typeutil
.
UniqueID
][]
string
)
*
timetickSync
{
// initialize dml channels used for insert
// initialize dml channels used for insert
dmlChannels
:=
newDmlChannels
(
ctx
,
factory
,
Params
.
RootCoordCfg
.
DmlChannelName
,
Params
.
RootCoordCfg
.
DmlChannelNum
)
dmlChannels
:=
newDmlChannels
(
ctx
,
factory
,
Params
.
RootCoordCfg
.
DmlChannelName
,
Params
.
RootCoordCfg
.
DmlChannelNum
)
// initialize delta channels used for delete, share Params.DmlChannelNum with dmlChannels
// initialize delta channels used for delete, share Params.DmlChannelNum with dmlChannels
...
@@ -110,8 +110,8 @@ func newTimeTickSync(ctx context.Context, session *sessionutil.Session, factory
...
@@ -110,8 +110,8 @@ func newTimeTickSync(ctx context.Context, session *sessionutil.Session, factory
}
}
return
&
timetickSync
{
return
&
timetickSync
{
ctx
:
ctx
,
ctx
:
ctx
,
s
ession
:
session
,
s
ourceID
:
sourceID
,
dmlChannels
:
dmlChannels
,
dmlChannels
:
dmlChannels
,
deltaChannels
:
deltaChannels
,
deltaChannels
:
deltaChannels
,
...
@@ -236,7 +236,7 @@ func (t *timetickSync) updateTimeTick(in *internalpb.ChannelTimeTickMsg, reason
...
@@ -236,7 +236,7 @@ func (t *timetickSync) updateTimeTick(in *internalpb.ChannelTimeTickMsg, reason
return
nil
return
nil
}
}
if
in
.
Base
.
SourceID
==
t
.
s
ession
.
Server
ID
{
if
in
.
Base
.
SourceID
==
t
.
s
ource
ID
{
if
prev
!=
nil
&&
in
.
DefaultTimestamp
<=
prev
.
defaultTs
{
if
prev
!=
nil
&&
in
.
DefaultTimestamp
<=
prev
.
defaultTs
{
log
.
Debug
(
"timestamp go back"
,
zap
.
Int64
(
"source id"
,
in
.
Base
.
SourceID
),
log
.
Debug
(
"timestamp go back"
,
zap
.
Int64
(
"source id"
,
in
.
Base
.
SourceID
),
zap
.
Uint64
(
"curr ts"
,
in
.
DefaultTimestamp
),
zap
.
Uint64
(
"curr ts"
,
in
.
DefaultTimestamp
),
...
@@ -273,7 +273,7 @@ func (t *timetickSync) delProxy(sess *sessionutil.Session) {
...
@@ -273,7 +273,7 @@ func (t *timetickSync) delProxy(sess *sessionutil.Session) {
}
}
}
}
func
(
t
*
timetickSync
)
get
Proxy
(
sess
[]
*
sessionutil
.
Session
)
{
func
(
t
*
timetickSync
)
clear
Proxy
(
sess
[]
*
sessionutil
.
Session
)
{
t
.
lock
.
Lock
()
t
.
lock
.
Lock
()
defer
t
.
lock
.
Unlock
()
defer
t
.
lock
.
Unlock
()
for
_
,
s
:=
range
sess
{
for
_
,
s
:=
range
sess
{
...
@@ -304,7 +304,7 @@ func (t *timetickSync) startWatch(wg *sync.WaitGroup) {
...
@@ -304,7 +304,7 @@ func (t *timetickSync) startWatch(wg *sync.WaitGroup) {
}
}
// reduce each channel to get min timestamp
// reduce each channel to get min timestamp
local
:=
proxyTimetick
[
t
.
s
ession
.
Server
ID
]
local
:=
proxyTimetick
[
t
.
s
ource
ID
]
if
len
(
local
.
chanTs
)
==
0
{
if
len
(
local
.
chanTs
)
==
0
{
continue
continue
}
}
...
@@ -356,7 +356,7 @@ func (t *timetickSync) sendTimeTickToChannel(chanNames []string, ts typeutil.Tim
...
@@ -356,7 +356,7 @@ func (t *timetickSync) sendTimeTickToChannel(chanNames []string, ts typeutil.Tim
MsgType
:
commonpb
.
MsgType_TimeTick
,
MsgType
:
commonpb
.
MsgType_TimeTick
,
MsgID
:
0
,
MsgID
:
0
,
Timestamp
:
ts
,
Timestamp
:
ts
,
SourceID
:
t
.
s
ession
.
Server
ID
,
SourceID
:
t
.
s
ource
ID
,
},
},
}
}
timeTickMsg
:=
&
msgstream
.
TimeTickMsg
{
timeTickMsg
:=
&
msgstream
.
TimeTickMsg
{
...
...
internal/rootcoord/timeticksync_test.go
浏览文件 @
1b1d4e50
...
@@ -26,15 +26,11 @@ import (
...
@@ -26,15 +26,11 @@ import (
"github.com/milvus-io/milvus/internal/msgstream"
"github.com/milvus-io/milvus/internal/msgstream"
"github.com/milvus-io/milvus/internal/proto/commonpb"
"github.com/milvus-io/milvus/internal/proto/commonpb"
"github.com/milvus-io/milvus/internal/proto/internalpb"
"github.com/milvus-io/milvus/internal/proto/internalpb"
"github.com/milvus-io/milvus/internal/util/sessionutil"
)
)
func
TestTimetickSync
(
t
*
testing
.
T
)
{
func
TestTimetickSync
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
sourceID
:=
int64
(
100
)
session
:=
&
sessionutil
.
Session
{
ServerID
:
100
,
}
factory
:=
msgstream
.
NewPmsFactory
()
factory
:=
msgstream
.
NewPmsFactory
()
m
:=
map
[
string
]
interface
{}{
m
:=
map
[
string
]
interface
{}{
...
@@ -51,7 +47,7 @@ func TestTimetickSync(t *testing.T) {
...
@@ -51,7 +47,7 @@ func TestTimetickSync(t *testing.T) {
Params
.
RootCoordCfg
.
DmlChannelNum
=
2
Params
.
RootCoordCfg
.
DmlChannelNum
=
2
Params
.
RootCoordCfg
.
DmlChannelName
=
"rootcoord-dml"
Params
.
RootCoordCfg
.
DmlChannelName
=
"rootcoord-dml"
Params
.
RootCoordCfg
.
DeltaChannelName
=
"rootcoord-delta"
Params
.
RootCoordCfg
.
DeltaChannelName
=
"rootcoord-delta"
ttSync
:=
newTimeTickSync
(
ctx
,
s
ession
,
factory
,
nil
)
ttSync
:=
newTimeTickSync
(
ctx
,
s
ourceID
,
factory
,
nil
)
var
wg
sync
.
WaitGroup
var
wg
sync
.
WaitGroup
wg
.
Add
(
1
)
wg
.
Add
(
1
)
...
@@ -108,7 +104,7 @@ func TestTimetickSync(t *testing.T) {
...
@@ -108,7 +104,7 @@ func TestTimetickSync(t *testing.T) {
assert
.
Nil
(
t
,
err
)
assert
.
Nil
(
t
,
err
)
ttSync
.
ddlMinTs
=
uint64
(
300
)
ttSync
.
ddlMinTs
=
uint64
(
300
)
ttSync
.
s
ession
.
Server
ID
=
int64
(
1
)
ttSync
.
s
ource
ID
=
int64
(
1
)
err
=
ttSync
.
updateTimeTick
(
msg
,
"1"
)
err
=
ttSync
.
updateTimeTick
(
msg
,
"1"
)
assert
.
Nil
(
t
,
err
)
assert
.
Nil
(
t
,
err
)
})
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录