Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
3630eec9
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,发现更多精彩内容 >>
未验证
提交
3630eec9
编写于
5月 27, 2021
作者:
X
xige-16
提交者:
GitHub
5月 27, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix receving wrong msg after seek (#5441)
Signed-off-by:
N
xige-16
<
xi.ge@zilliz.com
>
上级
9aa1fd25
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
321 addition
and
107 deletion
+321
-107
internal/msgstream/mq_msgstream.go
internal/msgstream/mq_msgstream.go
+12
-9
internal/msgstream/mq_msgstream_test.go
internal/msgstream/mq_msgstream_test.go
+309
-98
未找到文件。
internal/msgstream/mq_msgstream.go
浏览文件 @
3630eec9
...
@@ -102,8 +102,7 @@ func (ms *mqMsgStream) AsProducer(channels []string) {
...
@@ -102,8 +102,7 @@ func (ms *mqMsgStream) AsProducer(channels []string) {
}
}
}
}
func
(
ms
*
mqMsgStream
)
AsConsumer
(
channels
[]
string
,
func
(
ms
*
mqMsgStream
)
AsConsumer
(
channels
[]
string
,
subName
string
)
{
subName
string
)
{
for
_
,
channel
:=
range
channels
{
for
_
,
channel
:=
range
channels
{
if
_
,
ok
:=
ms
.
consumers
[
channel
];
ok
{
if
_
,
ok
:=
ms
.
consumers
[
channel
];
ok
{
continue
continue
...
@@ -190,14 +189,14 @@ func (ms *mqMsgStream) GetProduceChannels() []string {
...
@@ -190,14 +189,14 @@ func (ms *mqMsgStream) GetProduceChannels() []string {
}
}
func
(
ms
*
mqMsgStream
)
Produce
(
msgPack
*
MsgPack
)
error
{
func
(
ms
*
mqMsgStream
)
Produce
(
msgPack
*
MsgPack
)
error
{
tsMsgs
:=
msgPack
.
Msgs
if
msgPack
==
nil
||
len
(
msgPack
.
Msgs
)
<=
0
{
if
len
(
tsMsgs
)
<=
0
{
log
.
Debug
(
"Warning: Receive empty msgPack"
)
log
.
Debug
(
"Warning: Receive empty msgPack"
)
return
nil
return
nil
}
}
if
len
(
ms
.
producers
)
<=
0
{
if
len
(
ms
.
producers
)
<=
0
{
return
errors
.
New
(
"nil producer in msg stream"
)
return
errors
.
New
(
"nil producer in msg stream"
)
}
}
tsMsgs
:=
msgPack
.
Msgs
reBucketValues
:=
ms
.
ComputeProduceChannelIndexes
(
msgPack
.
Msgs
)
reBucketValues
:=
ms
.
ComputeProduceChannelIndexes
(
msgPack
.
Msgs
)
var
result
map
[
int32
]
*
MsgPack
var
result
map
[
int32
]
*
MsgPack
var
err
error
var
err
error
...
@@ -251,6 +250,10 @@ func (ms *mqMsgStream) Produce(msgPack *MsgPack) error {
...
@@ -251,6 +250,10 @@ func (ms *mqMsgStream) Produce(msgPack *MsgPack) error {
}
}
func
(
ms
*
mqMsgStream
)
Broadcast
(
msgPack
*
MsgPack
)
error
{
func
(
ms
*
mqMsgStream
)
Broadcast
(
msgPack
*
MsgPack
)
error
{
if
msgPack
==
nil
||
len
(
msgPack
.
Msgs
)
<=
0
{
log
.
Debug
(
"Warning: Receive empty msgPack"
)
return
nil
}
for
_
,
v
:=
range
msgPack
.
Msgs
{
for
_
,
v
:=
range
msgPack
.
Msgs
{
sp
,
spanCtx
:=
MsgSpanFromCtx
(
v
.
TraceCtx
(),
v
)
sp
,
spanCtx
:=
MsgSpanFromCtx
(
v
.
TraceCtx
(),
v
)
...
@@ -479,7 +482,6 @@ func (ms *MqTtMsgStream) Close() {
...
@@ -479,7 +482,6 @@ func (ms *MqTtMsgStream) Close() {
func
(
ms
*
MqTtMsgStream
)
bufMsgPackToChannel
()
{
func
(
ms
*
MqTtMsgStream
)
bufMsgPackToChannel
()
{
defer
ms
.
wait
.
Done
()
defer
ms
.
wait
.
Done
()
ms
.
unsolvedBuf
=
make
(
map
[
mqclient
.
Consumer
][]
TsMsg
)
isChannelReady
:=
make
(
map
[
mqclient
.
Consumer
]
bool
)
isChannelReady
:=
make
(
map
[
mqclient
.
Consumer
]
bool
)
eofMsgTimeStamp
:=
make
(
map
[
mqclient
.
Consumer
]
Timestamp
)
eofMsgTimeStamp
:=
make
(
map
[
mqclient
.
Consumer
]
Timestamp
)
...
@@ -503,11 +505,11 @@ func (ms *MqTtMsgStream) bufMsgPackToChannel() {
...
@@ -503,11 +505,11 @@ func (ms *MqTtMsgStream) bufMsgPackToChannel() {
wg
.
Add
(
1
)
wg
.
Add
(
1
)
go
ms
.
findTimeTick
(
consumer
,
eofMsgTimeStamp
,
&
wg
,
&
findMapMutex
)
go
ms
.
findTimeTick
(
consumer
,
eofMsgTimeStamp
,
&
wg
,
&
findMapMutex
)
}
}
ms
.
consumerLock
.
Unlock
()
wg
.
Wait
()
wg
.
Wait
()
timeStamp
,
ok
:=
checkTimeTickMsg
(
eofMsgTimeStamp
,
isChannelReady
,
&
findMapMutex
)
timeStamp
,
ok
:=
checkTimeTickMsg
(
eofMsgTimeStamp
,
isChannelReady
,
&
findMapMutex
)
if
!
ok
||
timeStamp
<=
ms
.
lastTimeStamp
{
if
!
ok
||
timeStamp
<=
ms
.
lastTimeStamp
{
//log.Printf("All timeTick's timestamps are inconsistent")
//log.Printf("All timeTick's timestamps are inconsistent")
ms
.
consumerLock
.
Unlock
()
continue
continue
}
}
timeTickBuf
:=
make
([]
TsMsg
,
0
)
timeTickBuf
:=
make
([]
TsMsg
,
0
)
...
@@ -553,6 +555,7 @@ func (ms *MqTtMsgStream) bufMsgPackToChannel() {
...
@@ -553,6 +555,7 @@ func (ms *MqTtMsgStream) bufMsgPackToChannel() {
ms
.
msgPositions
[
consumer
]
=
newPos
ms
.
msgPositions
[
consumer
]
=
newPos
}
}
ms
.
unsolvedMutex
.
Unlock
()
ms
.
unsolvedMutex
.
Unlock
()
ms
.
consumerLock
.
Unlock
()
msgPack
:=
MsgPack
{
msgPack
:=
MsgPack
{
BeginTs
:
ms
.
lastTimeStamp
,
BeginTs
:
ms
.
lastTimeStamp
,
...
@@ -712,9 +715,9 @@ func (ms *MqTtMsgStream) Seek(mp *internalpb.MsgPosition) error {
...
@@ -712,9 +715,9 @@ func (ms *MqTtMsgStream) Seek(mp *internalpb.MsgPosition) error {
ms
.
addConsumer
(
consumer
,
seekChannel
)
ms
.
addConsumer
(
consumer
,
seekChannel
)
//TODO: May cause problem
//TODO: May cause problem
if
len
(
consumer
.
Chan
())
==
0
{
//
if len(consumer.Chan()) == 0 {
return
nil
//
return nil
}
//
}
for
{
for
{
select
{
select
{
...
...
internal/msgstream/mq_msgstream_test.go
浏览文件 @
3630eec9
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录