refactoring

This commit is contained in:
Chris Lu
2026-01-04 11:40:42 -08:00
parent 8269dc136d
commit 0e9f433ec4
3 changed files with 30 additions and 32 deletions

View File

@@ -89,7 +89,7 @@ func (b *MessageQueueBroker) GetUnflushedMessages(req *mq_pb.GetUnflushedMessage
}
// Use buffer_start offset for precise deduplication
lastFlushTsNs := localPartition.LogBuffer.LastFlushTsNs
lastFlushTsNs := localPartition.LogBuffer.GetLastFlushTsNs()
startBufferOffset := req.StartBufferOffset
startTimeNs := lastFlushTsNs // Still respect last flush time for safety

View File

@@ -2,7 +2,6 @@ package broker
import (
"fmt"
"sync/atomic"
"time"
"github.com/seaweedfs/seaweedfs/weed/glog"
@@ -41,14 +40,14 @@ func (b *MessageQueueBroker) genLogFlushFunc(t topic.Topic, p topic.Partition) l
}
}
atomic.StoreInt64(&logBuffer.LastFlushTsNs, stopTime.UnixNano())
logBuffer.SetLastFlushTsNs(stopTime.UnixNano())
b.accessLock.Lock()
defer b.accessLock.Unlock()
if localPartition := b.localTopicManager.GetLocalPartition(t, p); localPartition != nil {
localPartition.NotifyLogFlushed(logBuffer.LastFlushTsNs)
localPartition.NotifyLogFlushed(logBuffer.GetLastFlushTsNs())
}
glog.V(0).Infof("flushing at %d to %s size %d from buffer %s (offset %d)", logBuffer.LastFlushTsNs, targetFile, len(buf), logBuffer.GetName(), bufferOffset)
glog.V(0).Infof("flushing at %d to %s size %d from buffer %s (offset %d)", logBuffer.GetLastFlushTsNs(), targetFile, len(buf), logBuffer.GetName(), bufferOffset)
}
}