This commit is contained in:
chrislu 2022-03-14 03:19:16 -07:00
parent 2eda3a686f
commit fbc9f0eb64

View file

@ -62,7 +62,7 @@ func NewFileReader(filerClient filer_pb.FilerClient, entry *filer_pb.Entry) io.R
func StreamContent(masterClient wdclient.HasLookupFileIdFunction, writer io.Writer, chunks []*filer_pb.FileChunk, offset int64, size int64) error { func StreamContent(masterClient wdclient.HasLookupFileIdFunction, writer io.Writer, chunks []*filer_pb.FileChunk, offset int64, size int64) error {
glog.V(9).Infof("start to stream content for chunks: %+v\n", chunks) glog.V(4).Infof("start to stream content for chunks: %+v", chunks)
chunkViews := ViewFromChunks(masterClient.GetLookupFileIdFunction(), chunks, offset, size) chunkViews := ViewFromChunks(masterClient.GetLookupFileIdFunction(), chunks, offset, size)
fileId2Url := make(map[string][]string) fileId2Url := make(map[string][]string)
@ -104,10 +104,12 @@ func StreamContent(masterClient wdclient.HasLookupFileIdFunction, writer io.Writ
} }
stats.FilerRequestCounter.WithLabelValues("chunkDownload").Inc() stats.FilerRequestCounter.WithLabelValues("chunkDownload").Inc()
} }
glog.V(4).Infof("zero [%d,%d)", offset, offset+remaining) if remaining > 0 {
err := writeZero(writer, remaining) glog.V(4).Infof("zero [%d,%d)", offset, offset+remaining)
if err != nil { err := writeZero(writer, remaining)
return fmt.Errorf("write zero [%d,%d)", offset, offset+remaining) if err != nil {
return fmt.Errorf("write zero [%d,%d)", offset, offset+remaining)
}
} }
return nil return nil