mirror of https://github.com/milvus-io/milvus.git
Fix 16961, make creating dml stream idempotent (#17302)
Signed-off-by: longjiquan <jiquan.long@zilliz.com>pull/17304/head
parent
d920e5c915
commit
72f454e054
|
@ -329,7 +329,17 @@ func (mgr *singleTypeChannelsMgr) getVChannels(collectionID UniqueID) ([]vChan,
|
|||
return nil, err
|
||||
}
|
||||
|
||||
func (mgr *singleTypeChannelsMgr) streamExist(collectionID UniqueID) bool {
|
||||
stream, err := mgr.getStream(collectionID)
|
||||
return err == nil && stream != nil
|
||||
}
|
||||
|
||||
func (mgr *singleTypeChannelsMgr) createMsgStream(collectionID UniqueID) error {
|
||||
if mgr.streamExist(collectionID) {
|
||||
log.Info("stream already exist, no need to re-create", zap.Int64("collection_id", collectionID))
|
||||
return nil
|
||||
}
|
||||
|
||||
channels, err := mgr.getChannelsFunc(collectionID)
|
||||
if err != nil {
|
||||
log.Warn("failed to create message stream",
|
||||
|
|
|
@ -74,6 +74,10 @@ func TestChannelsMgrImpl_createDMLMsgStream(t *testing.T) {
|
|||
err = mgr.createDMLMsgStream(collID)
|
||||
assert.Equal(t, nil, err)
|
||||
|
||||
// re-create message stream.
|
||||
err = mgr.createDMLMsgStream(collID)
|
||||
assert.Equal(t, nil, err)
|
||||
|
||||
_, err = mgr.getChannels(collID)
|
||||
assert.Equal(t, nil, err)
|
||||
_, err = mgr.getVChannels(collID)
|
||||
|
|
Loading…
Reference in New Issue