diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2025-10-24 01:26:42 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-24 01:26:42 -0700 |
| commit | 7d147f238c51f3df77da8b13d48b86ede83497ce (patch) | |
| tree | 63b7dce990fe3e31c5f320c2ee86ebbcf2d3faba /weed/util/log_buffer/log_read.go | |
| parent | d220875ef4601e74b6ab49e47f8e2dd36510482c (diff) | |
| download | seaweedfs-7d147f238c51f3df77da8b13d48b86ede83497ce.tar.xz seaweedfs-7d147f238c51f3df77da8b13d48b86ede83497ce.zip | |
avoid repeated reading disk (#7369)
* avoid repeated reading disk
* checks both flush time AND read position advancement
* wait on cond
* fix reading
Gap detection and skipping to earliest memory time
Time-based reads that include events at boundary times for first reads (offset ≤ 0)
Aggregated subscriber wake-up via ListenersWaits signaling
* address comments
Diffstat (limited to 'weed/util/log_buffer/log_read.go')
| -rw-r--r-- | weed/util/log_buffer/log_read.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/weed/util/log_buffer/log_read.go b/weed/util/log_buffer/log_read.go index 3b7b99ada..950604022 100644 --- a/weed/util/log_buffer/log_read.go +++ b/weed/util/log_buffer/log_read.go @@ -270,7 +270,7 @@ func (logBuffer *LogBuffer) LoopProcessLogDataWithOffset(readerName string, star return } - // CRITICAL FIX: If we're reading offset-based and there's no data in LogBuffer, + // If we're reading offset-based and there's no data in LogBuffer, // return ResumeFromDiskError to let Subscribe try reading from disk again. // This prevents infinite blocking when all data is on disk (e.g., after restart). if startPosition.IsOffsetBased { @@ -355,7 +355,6 @@ func (logBuffer *LogBuffer) LoopProcessLogDataWithOffset(readerName string, star continue } - glog.V(4).Infof("Unmarshaled log entry %d: TsNs=%d, Offset=%d, Key=%s", batchSize+1, logEntry.TsNs, logEntry.Offset, string(logEntry.Key)) // Handle offset-based filtering for offset-based start positions @@ -377,7 +376,7 @@ func (logBuffer *LogBuffer) LoopProcessLogDataWithOffset(readerName string, star // println("stopTsNs", stopTsNs, "logEntry.TsNs", logEntry.TsNs) return } - // CRITICAL FIX: Use logEntry.Offset + 1 to move PAST the current entry + // Use logEntry.Offset + 1 to move PAST the current entry // This prevents infinite loops where we keep requesting the same offset lastReadPosition = NewMessagePosition(logEntry.TsNs, logEntry.Offset+1) |
