Use read lock when only read the var (#12711)

Signed-off-by: Cai.Zhang <cai.zhang@zilliz.com>
This commit is contained in:
cai.zhang 2021-12-06 15:23:41 +08:00 committed by GitHub
parent 6c1a471570
commit dd88083db7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -471,8 +471,8 @@ func (s *Segment) getIndexName(fieldID int64) string {
}
func (s *Segment) getIndexID(fieldID int64) UniqueID {
s.paramMutex.Lock()
defer s.paramMutex.Unlock()
s.paramMutex.RLock()
defer s.paramMutex.RUnlock()
if _, ok := s.indexInfos[fieldID]; !ok {
return -1
}