aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Lebedev <lebedev_k@tochka.com>2021-03-11 22:38:59 +0500
committerKonstantin Lebedev <lebedev_k@tochka.com>2021-03-11 22:38:59 +0500
commit4db21012c1604d535420d4a892c06daecb795c1f (patch)
tree0c817a5305adfdb5bc47fe1daff5460dee357d2a
parent2e197604422214abd1034ee93ab38ab588e110e5 (diff)
downloadseaweedfs-4db21012c1604d535420d4a892c06daecb795c1f.tar.xz
seaweedfs-4db21012c1604d535420d4a892c06daecb795c1f.zip
error if read chunk zero data size
-rw-r--r--weed/filer/stream.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/weed/filer/stream.go b/weed/filer/stream.go
index 6a87a2b7d..292e41f82 100644
--- a/weed/filer/stream.go
+++ b/weed/filer/stream.go
@@ -15,7 +15,7 @@ import (
func StreamContent(masterClient wdclient.HasLookupFileIdFunction, w io.Writer, chunks []*filer_pb.FileChunk, offset int64, size int64) error {
- // fmt.Printf("start to stream content for chunks: %+v\n", chunks)
+ glog.V(9).Infof("start to stream content for chunks: %+v\n", chunks)
chunkViews := ViewFromChunks(masterClient.GetLookupFileIdFunction(), chunks, offset, size)
fileId2Url := make(map[string][]string)
@@ -38,7 +38,14 @@ func StreamContent(masterClient wdclient.HasLookupFileIdFunction, w io.Writer, c
if err != nil {
glog.Errorf("read chunk: %v", err)
return fmt.Errorf("read chunk: %v", err)
+ } else if len(data) == 0 {
+ glog.Errorf("data size zero read chunk: %s", urlStrings)
+ return fmt.Errorf("data size zero read chunk: %s", urlStrings)
+ } else if len(chunkViews) == 1 && int64(len(data)) != size {
+ glog.Errorf("data size not eq %i read chunk: %s", size, urlStrings)
+ return fmt.Errorf("data size not eq %i read chunk: %s", size, urlStrings)
}
+
_, err = w.Write(data)
if err != nil {
glog.Errorf("write chunk: %v", err)