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 possible deadlock: move metadata log flush channel out of lock scope
chrislud310711de065
diff --git a/weed/util/log_buffer/log_buffer.go b/weed/util/log_buffer/log_buffer.goindex d5e6cb214d..422575193e 100644--- a/weed/util/log_buffer/log_buffer.go+++ b/weed/util/log_buffer/log_buffer.go@@ -58,9 +58,13 @@ func NewLogBuffer(name string, flushInterval time.Duration, flushFn func(startTifunc (m *LogBuffer) AddToBuffer(partitionKey, data []byte, processingTsNs int64) {+ var toFlush *dataToFlushm.Lock()defer func() {m.Unlock()+ if toFlush != nil {+ m.flushChan <- toFlush+ }if m.notifyFn != nil {m.notifyFn()}@@ -96,7 +100,7 @@ func (m *LogBuffer) AddToBuffer(partitionKey, data []byte, processingTsNs int64)if m.startTime.Add(m.flushInterval).Before(ts) || len(m.buf)-m.pos < size+4 {// glog.V(4).Infof("%s copyToFlush1 start time %v, ts %v, remaining %d bytes", m.name, m.startTime, ts, len(m.buf)-m.pos)- m.flushChan <- m.copyToFlush()+ toFlush = m.copyToFlush()m.startTime = tsif len(m.buf) < size+4 {m.buf = make([]byte, 2*size+4)@@ -148,8 +152,10 @@ func (m *LogBuffer) loopInterval() {return}toFlush := m.copyToFlush()- m.flushChan <- toFlushm.Unlock()+ if toFlush != nil {+ m.flushChan <- toFlush+ }}}