Use Wlock when release segment (#20092)

Signed-off-by: bigsheeper <yihao.dai@zilliz.com>

Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
This commit is contained in:
bigsheeper 2022-10-26 18:59:32 +08:00 committed by GitHub
parent c24244240e
commit 51e50bba73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -635,15 +635,15 @@ func (replica *metaReplica) removeSegment(segmentID UniqueID, segType segmentTyp
case segmentTypeGrowing:
if segment, ok := replica.growingSegments[segmentID]; ok {
if collection, ok := replica.collections[segment.collectionID]; ok {
collection.RLock()
defer collection.RUnlock()
collection.Lock()
defer collection.Unlock()
}
}
case segmentTypeSealed:
if segment, ok := replica.sealedSegments[segmentID]; ok {
if collection, ok := replica.collections[segment.collectionID]; ok {
collection.RLock()
defer collection.RUnlock()
collection.Lock()
defer collection.Unlock()
}
}
default: