SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
avoid data race of LogBuffer isStopping (#3859)
Konstantin Lebedevee38ab858125
diff --git a/weed/util/log_buffer/log_buffer.go b/weed/util/log_buffer/log_buffer.goindex 86857b5636..2d12a5bf29 100644--- a/weed/util/log_buffer/log_buffer.go+++ b/weed/util/log_buffer/log_buffer.go@@ -118,6 +118,13 @@ func (m *LogBuffer) AddToBuffer(partitionKey, data []byte, processingTsNs int64)}+func (m *LogBuffer) IsStopping() bool {+ m.RLock()+ defer m.RUnlock()++ return m.isStopping+}+func (m *LogBuffer) Shutdown() {m.Lock()defer m.Unlock()@@ -144,13 +151,12 @@ func (m *LogBuffer) loopFlush() {}func (m *LogBuffer) loopInterval() {- for !m.isStopping {+ for !m.IsStopping() {time.Sleep(m.flushInterval)- m.Lock()- if m.isStopping {- m.Unlock()+ if m.IsStopping() {return}+ m.Lock()toFlush := m.copyToFlush()m.Unlock()if toFlush != nil {