mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
Optimize recentlyModified's lock (#15120)
Signed-off-by: xige-16 <xi.ge@zilliz.com>
This commit is contained in:
parent
828b9d399f
commit
99315ce00e
@ -92,7 +92,7 @@ type Segment struct {
|
||||
once sync.Once // guards enableIndex
|
||||
enableIndex bool
|
||||
|
||||
rmMutex sync.Mutex // guards recentlyModified
|
||||
rmMutex sync.RWMutex // guards recentlyModified
|
||||
recentlyModified bool
|
||||
|
||||
typeMu sync.Mutex // guards builtIndex
|
||||
@ -141,8 +141,8 @@ func (s *Segment) setRecentlyModified(modify bool) {
|
||||
}
|
||||
|
||||
func (s *Segment) getRecentlyModified() bool {
|
||||
s.rmMutex.Lock()
|
||||
defer s.rmMutex.Unlock()
|
||||
s.rmMutex.RLock()
|
||||
defer s.rmMutex.RUnlock()
|
||||
return s.recentlyModified
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user