mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-11-25 11:39:12 +08:00
add memory buffer size limit
This commit is contained in:
parent
258fba8a0f
commit
5eb83dfbd3
@ -170,14 +170,15 @@ func (m *LogBuffer) ReadFromBuffer(lastReadTime time.Time) (bufferCopy *bytes.Bu
|
||||
for i, buf := range m.prevBuffers.buffers {
|
||||
if buf.startTime.After(lastReadTime) {
|
||||
if i == 0 {
|
||||
println("return the earliest in memory")
|
||||
// println("return the earliest in memory", buf.startTime.UnixNano())
|
||||
return copiedBytes(buf.buf[:buf.size])
|
||||
}
|
||||
return copiedBytes(buf.buf[:buf.size])
|
||||
}
|
||||
if !buf.startTime.After(lastReadTime) && buf.stopTime.After(lastReadTime) {
|
||||
pos := buf.locateByTs(lastReadTime)
|
||||
return copiedBytes(buf.buf[pos:])
|
||||
// fmt.Printf("locate buffer[%d] pos %d\n", i, pos)
|
||||
return copiedBytes(buf.buf[pos:buf.size])
|
||||
}
|
||||
}
|
||||
return copiedBytes(m.buf[:m.pos])
|
||||
|
Loading…
Reference in New Issue
Block a user