fix: get replicate channel position (#41188)

- issue: #41187

Signed-off-by: SimFG <bang.fu@zilliz.com>
This commit is contained in:
SimFG 2025-04-10 15:14:28 +08:00 committed by GitHub
parent 6f4dc8dda2
commit a308d2c886
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 13 deletions

View File

@ -6512,18 +6512,6 @@ func (node *Proxy) ReplicateMessage(ctx context.Context, req *milvuspb.Replicate
return &milvuspb.ReplicateMessageResponse{Status: merr.Status(err)}, nil return &milvuspb.ReplicateMessageResponse{Status: merr.Status(err)}, nil
} }
collectionReplicateEnable := paramtable.Get().CommonCfg.CollectionReplicateEnable.GetAsBool()
ttMsgEnabled := paramtable.Get().CommonCfg.TTMsgEnabled.GetAsBool()
// replicate message can be use in two ways, otherwise return error
// 1. collectionReplicateEnable is false and ttMsgEnabled is false, active/standby mode
// 2. collectionReplicateEnable is true and ttMsgEnabled is true, data migration mode
if (!collectionReplicateEnable && ttMsgEnabled) || (collectionReplicateEnable && !ttMsgEnabled) {
return &milvuspb.ReplicateMessageResponse{
Status: merr.Status(merr.ErrDenyReplicateMessage),
}, nil
}
var err error var err error
if req.GetChannelName() == "" { if req.GetChannelName() == "" {
log.Ctx(ctx).Warn("channel name is empty") log.Ctx(ctx).Warn("channel name is empty")
@ -6555,6 +6543,18 @@ func (node *Proxy) ReplicateMessage(ctx context.Context, req *milvuspb.Replicate
}, nil }, nil
} }
collectionReplicateEnable := paramtable.Get().CommonCfg.CollectionReplicateEnable.GetAsBool()
ttMsgEnabled := paramtable.Get().CommonCfg.TTMsgEnabled.GetAsBool()
// replicate message can be use in two ways, otherwise return error
// 1. collectionReplicateEnable is false and ttMsgEnabled is false, active/standby mode
// 2. collectionReplicateEnable is true and ttMsgEnabled is true, data migration mode
if (!collectionReplicateEnable && ttMsgEnabled) || (collectionReplicateEnable && !ttMsgEnabled) {
return &milvuspb.ReplicateMessageResponse{
Status: merr.Status(merr.ErrDenyReplicateMessage),
}, nil
}
msgPack := &msgstream.MsgPack{ msgPack := &msgstream.MsgPack{
BeginTs: req.BeginTs, BeginTs: req.BeginTs,
EndTs: req.EndTs, EndTs: req.EndTs,

View File

@ -172,7 +172,10 @@ func TestManager(t *testing.T) {
assert.Equal(t, 3, c.NumTarget()) assert.Equal(t, 3, c.NumTarget())
assert.Eventually(t, func() bool { assert.Eventually(t, func() bool {
return c.NumConsumer() >= 1 return c.NumConsumer() >= 1
}, 3*time.Second, 10*time.Millisecond) }, 10*time.Second, 10*time.Millisecond)
if c.(*dispatcherManager).mainDispatcher == nil {
t.FailNow()
}
c.(*dispatcherManager).mainDispatcher.curTs.Store(1000) c.(*dispatcherManager).mainDispatcher.curTs.Store(1000)
for _, d := range c.(*dispatcherManager).deputyDispatchers { for _, d := range c.(*dispatcherManager).deputyDispatchers {
d.curTs.Store(1000) d.curTs.Store(1000)