Use write lock when writing the var (#12528)

Signed-off-by: Cai.Zhang <cai.zhang@zilliz.com>
This commit is contained in:
cai.zhang 2021-12-01 22:26:10 +08:00 committed by GitHub
parent a7af1042db
commit deaf4a642c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -532,8 +532,8 @@ func (s *Segment) matchIndexParam(fieldID int64, indexParams indexParam) bool {
} }
func (s *Segment) setIndexInfo(fieldID int64, info *indexInfo) error { func (s *Segment) setIndexInfo(fieldID int64, info *indexInfo) error {
s.paramMutex.RLock() s.paramMutex.Lock()
defer s.paramMutex.RUnlock() defer s.paramMutex.Unlock()
if s.indexInfos == nil { if s.indexInfos == nil {
return errors.New("indexInfos hasn't been init") return errors.New("indexInfos hasn't been init")
} }