mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
avoid overflow
This commit is contained in:
parent
e1911760a7
commit
f06ca04451
|
@ -3,6 +3,7 @@ package filer2
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"hash/fnv"
|
"hash/fnv"
|
||||||
|
"math"
|
||||||
"sort"
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
@ -86,6 +87,12 @@ func ViewFromChunks(chunks []*filer_pb.FileChunk, offset int64, size int64) (vie
|
||||||
func ViewFromVisibleIntervals(visibles []VisibleInterval, offset int64, size int64) (views []*ChunkView) {
|
func ViewFromVisibleIntervals(visibles []VisibleInterval, offset int64, size int64) (views []*ChunkView) {
|
||||||
|
|
||||||
stop := offset + size
|
stop := offset + size
|
||||||
|
if size == math.MaxInt64 {
|
||||||
|
stop = math.MaxInt64
|
||||||
|
}
|
||||||
|
if stop < offset {
|
||||||
|
stop = math.MaxInt64
|
||||||
|
}
|
||||||
|
|
||||||
for _, chunk := range visibles {
|
for _, chunk := range visibles {
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ var _ = io.ReadSeeker(&ChunkStreamReader{})
|
||||||
|
|
||||||
func NewChunkStreamReaderFromFiler(masterClient *wdclient.MasterClient, chunks []*filer_pb.FileChunk) *ChunkStreamReader {
|
func NewChunkStreamReaderFromFiler(masterClient *wdclient.MasterClient, chunks []*filer_pb.FileChunk) *ChunkStreamReader {
|
||||||
|
|
||||||
chunkViews := ViewFromChunks(chunks, 0, math.MaxInt64)
|
chunkViews := ViewFromChunks(chunks, 0, math.MaxInt32)
|
||||||
|
|
||||||
return &ChunkStreamReader{
|
return &ChunkStreamReader{
|
||||||
chunkViews: chunkViews,
|
chunkViews: chunkViews,
|
||||||
|
|
Loading…
Reference in a new issue