mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/fs: fall back to cgo copy for copying the last 4KB of mmaped data
This probably should fix https://github.com/VictoriaMetrics/VictoriaMetrics/issues/581
This commit is contained in:
parent
1eed50b9ca
commit
08edb90814
1 changed files with 5 additions and 0 deletions
|
@ -90,6 +90,11 @@ func (r *ReaderAt) MustReadAt(p []byte, off int64) {
|
|||
}
|
||||
|
||||
func (r *ReaderAt) isInPageCache(start, end int64) bool {
|
||||
if int64(len(r.mmapData)) - end < 4096 {
|
||||
// If standard copy(dst, src) from Go may read beyond len(src), then this should help
|
||||
// fixing SIGBUS panic from https://github.com/VictoriaMetrics/VictoriaMetrics/issues/581
|
||||
return false
|
||||
}
|
||||
startBit := uint64(start) / pageSize
|
||||
endBit := uint64(end) / pageSize
|
||||
m := r.pageCacheBitmap.Load().(*pageCacheBitmap).m
|
||||
|
|
Loading…
Reference in a new issue