filer read empty file may cause OOM in some cases

fix https://github.com/chrislusf/seaweedfs/issues/2641
This commit is contained in:
chrislu
2022-02-07 23:08:54 -08:00
parent b1cff07ab0
commit 85c1615b43
5 changed files with 10 additions and 16 deletions

View File

@@ -4,7 +4,6 @@ import (
"bytes"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/wdclient"
"math"
"time"
)
@@ -23,7 +22,7 @@ func ReadEntry(masterClient *wdclient.MasterClient, filerClient filer_pb.Seaweed
return err
}
return StreamContent(masterClient, byteBuffer, respLookupEntry.Entry.Chunks, 0, math.MaxInt64)
return StreamContent(masterClient, byteBuffer, respLookupEntry.Entry.Chunks, 0, int64(FileSize(respLookupEntry.Entry)))
}