Use write lock when writing the var (#12528)

Signed-off-by: Cai.Zhang <cai.zhang@zilliz.com>
pull/12577/head
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
1 changed files with 2 additions and 2 deletions

View File

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