fix: sequence read rate is slow when use filer.ChunkReadAt.ReadAt #3074

related to https://github.com/chrislusf/seaweedfs/pull/3074
This commit is contained in:
chrislu 2022-06-07 22:33:35 -07:00
parent 666e620b63
commit ebd6097e6f

View file

@ -16,15 +16,17 @@ func NewReaderPattern() *ReaderPattern {
} }
func (rp *ReaderPattern) MonitorReadAt(offset int64, size int) { func (rp *ReaderPattern) MonitorReadAt(offset int64, size int) {
isStreaming := true
if rp.lastReadOffset > offset { if rp.lastReadOffset > offset {
rp.isStreaming = false isStreaming = false
} }
if rp.lastReadOffset == -1 { if rp.lastReadOffset == -1 {
if offset != 0 { if offset != 0 {
rp.isStreaming = false isStreaming = false
} }
} }
rp.lastReadOffset = offset rp.lastReadOffset = offset
rp.isStreaming = isStreaming
} }
func (rp *ReaderPattern) IsStreamingMode() bool { func (rp *ReaderPattern) IsStreamingMode() bool {