mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-08 01:58:34 +08:00
Fix DML channel AsProducer after Close (#16352)
Signed-off-by: xiaofan-luan <xiaofan.luan@zilliz.com>
This commit is contained in:
parent
5494f3c318
commit
7f7379d55f
@ -62,6 +62,7 @@ func newDmlChannels(ctx context.Context, factory msgstream.Factory, chanNamePref
|
|||||||
log.Error("Failed to add msgstream", zap.String("name", name), zap.Error(err))
|
log.Error("Failed to add msgstream", zap.String("name", name), zap.Error(err))
|
||||||
panic("Failed to add msgstream")
|
panic("Failed to add msgstream")
|
||||||
}
|
}
|
||||||
|
ms.AsProducer([]string{name})
|
||||||
d.pool.Store(name, &dmlMsgStream{
|
d.pool.Store(name, &dmlMsgStream{
|
||||||
ms: ms,
|
ms: ms,
|
||||||
mutex: sync.RWMutex{},
|
mutex: sync.RWMutex{},
|
||||||
@ -159,9 +160,6 @@ func (d *dmlChannels) addChannels(names ...string) {
|
|||||||
dms := v.(*dmlMsgStream)
|
dms := v.(*dmlMsgStream)
|
||||||
|
|
||||||
dms.mutex.Lock()
|
dms.mutex.Lock()
|
||||||
if dms.refcnt == 0 {
|
|
||||||
dms.ms.AsProducer([]string{name})
|
|
||||||
}
|
|
||||||
dms.refcnt++
|
dms.refcnt++
|
||||||
dms.mutex.Unlock()
|
dms.mutex.Unlock()
|
||||||
}
|
}
|
||||||
@ -180,9 +178,8 @@ func (d *dmlChannels) removeChannels(names ...string) {
|
|||||||
dms.mutex.Lock()
|
dms.mutex.Lock()
|
||||||
if dms.refcnt > 0 {
|
if dms.refcnt > 0 {
|
||||||
dms.refcnt--
|
dms.refcnt--
|
||||||
if dms.refcnt == 0 {
|
} else {
|
||||||
dms.ms.Close()
|
log.Warn("Try to remove channel with no ref count", zap.String("channel name", name))
|
||||||
}
|
|
||||||
}
|
}
|
||||||
dms.mutex.Unlock()
|
dms.mutex.Unlock()
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user