fix: [Cherry-pick] Use mutex protection when accessing pks of l0 segments (#31505) (#31517)

Cherry-pick from master
pr: #31505
See also #31504

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/31509/head
congqixia 2024-03-22 16:07:08 +08:00 committed by GitHub
parent 9174958335
commit b8d8805c87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -81,6 +81,8 @@ func (s *L0Segment) RowNum() int64 {
}
func (s *L0Segment) MemSize() int64 {
s.dataGuard.RLock()
defer s.dataGuard.RUnlock()
return lo.SumBy(s.pks, func(pk storage.PrimaryKey) int64 {
return pk.Size() + 8
})