aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2021-03-11 10:51:48 -0800
committerGitHub <noreply@github.com>2021-03-11 10:51:48 -0800
commit0e35836cc160676d2be861c000da8f395f2cb0fa (patch)
tree44422f761315ba4e8e294d4b76f071da1d7051d8
parent79280e151396d3b4aab13d8f78b944d6038a21e3 (diff)
parent58cdcc6d6eb13dd6c887cb7766aa7e4273c6051d (diff)
downloadseaweedfs-0e35836cc160676d2be861c000da8f395f2cb0fa.tar.xz
seaweedfs-0e35836cc160676d2be861c000da8f395f2cb0fa.zip
Merge pull request #1890 from kmlebedev/ZeroDataSize
error if read chunk zero data size
-rw-r--r--weed/filer/stream.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/weed/filer/stream.go b/weed/filer/stream.go
index 6a87a2b7d..573ab65e8 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)
@@ -26,6 +26,9 @@ func StreamContent(masterClient wdclient.HasLookupFileIdFunction, w io.Writer, c
if err != nil {
glog.V(1).Infof("operation LookupFileId %s failed, err: %v", chunkView.FileId, err)
return err
+ } else if len(urlStrings) == 0 {
+ glog.Errorf("operation LookupFileId %s failed, err: urls not found", chunkView.FileId)
+ return fmt.Errorf("operation LookupFileId %s failed, err: urls not found", chunkView.FileId)
}
fileId2Url[chunkView.FileId] = urlStrings
}
@@ -39,6 +42,7 @@ func StreamContent(masterClient wdclient.HasLookupFileIdFunction, w io.Writer, c
glog.Errorf("read chunk: %v", err)
return fmt.Errorf("read chunk: %v", err)
}
+
_, err = w.Write(data)
if err != nil {
glog.Errorf("write chunk: %v", err)