fix: Fix data race for clustering compaction writer (#35957)

issue: #35950

Signed-off-by: Cai Zhang <cai.zhang@zilliz.com>
This commit is contained in:
cai.zhang 2024-09-05 04:07:10 +08:00 committed by GitHub
parent 6eb8b3f745
commit 90bdb171ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -458,7 +458,9 @@ func (t *clusteringCompactionTask) mapping(ctx context.Context,
func (t *clusteringCompactionTask) getBufferTotalUsedMemorySize() int64 {
var totalBufferSize int64 = 0
for _, buffer := range t.clusterBuffers {
t.clusterBufferLocks.Lock(buffer.id)
totalBufferSize = totalBufferSize + int64(buffer.writer.WrittenMemorySize()) + buffer.bufferMemorySize.Load()
t.clusterBufferLocks.Unlock(buffer.id)
}
return totalBufferSize
}