未验证 提交 d845153d 编写于 作者: X Xiaofan 提交者: GitHub

Add Buffer for consumer channel (#9578)

Signed-off-by: Nxiaofan-luan <xiaofan.luan@zilliz.com>
上级 da5195aa
......@@ -19,6 +19,7 @@ package datanode
import (
"context"
"fmt"
"time"
"github.com/milvus-io/milvus/internal/log"
"github.com/milvus-io/milvus/internal/proto/internalpb"
......@@ -47,11 +48,13 @@ func newDmInputNode(ctx context.Context, seekPos *internalpb.MsgPosition, dmNode
if seekPos != nil {
seekPos.ChannelName = pchannelName
log.Debug("datanode Seek", zap.String("channelName", seekPos.GetChannelName()))
start := time.Now()
log.Debug("datanode begin to seek: " + seekPos.GetChannelName())
err = insertStream.Seek([]*internalpb.MsgPosition{seekPos})
if err != nil {
return nil, err
}
log.Debug("datanode Seek successfully: "+seekPos.GetChannelName(), zap.Int64("elapse ", time.Since(start).Milliseconds()))
}
node := flowgraph.NewInputNode(insertStream, "dmInputNode", dmNodeConfig.maxQueueLength, dmNodeConfig.maxParallelism)
......
......@@ -874,11 +874,6 @@ func (ms *MqTtMsgStream) Seek(msgPositions []*internalpb.MsgPosition) error {
}
ms.addConsumer(consumer, mp.ChannelName)
//TODO: May cause problem
//if len(consumer.Chan()) == 0 {
// return nil
//}
runLoop := true
for runLoop {
select {
......
......@@ -34,7 +34,7 @@ func (pc *pulsarConsumer) Subscription() string {
func (pc *pulsarConsumer) Chan() <-chan ConsumerMessage {
if pc.msgChannel == nil {
pc.once.Do(func() {
pc.msgChannel = make(chan ConsumerMessage)
pc.msgChannel = make(chan ConsumerMessage, 256)
// this part handles msgstream expectation when the consumer is not seeked
// pulsar's default behavior is setting postition to the earliest pointer when client of the same subscription pointer is not acked
// yet, our message stream is to setting to the very start point of the topic
......
......@@ -34,7 +34,7 @@ func (rc *RmqConsumer) Subscription() string {
func (rc *RmqConsumer) Chan() <-chan ConsumerMessage {
if rc.msgChannel == nil {
rc.once.Do(func() {
rc.msgChannel = make(chan ConsumerMessage)
rc.msgChannel = make(chan ConsumerMessage, 256)
go func() {
for { //nolint:gosimple
select {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册