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

Signed-off-by: Cai.Zhang <cai.zhang@zilliz.com>
pull/12841/head
cai.zhang 2021-12-07 10:01:52 +08:00 committed by GitHub
parent 395af1404f
commit 1f67ab4e09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

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