From badd8fdf8f049aade0ae17b9cbf1988802cffc7b Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 8 Jan 2019 09:03:28 -0800 Subject: [PATCH] shortcut for empty file --- weed/storage/volume_read_write.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/weed/storage/volume_read_write.go b/weed/storage/volume_read_write.go index b44900dd4..32062db46 100644 --- a/weed/storage/volume_read_write.go +++ b/weed/storage/volume_read_write.go @@ -145,6 +145,9 @@ func (v *Volume) readNeedle(n *Needle) (int, error) { if nv.Size == TombstoneFileSize { return -1, errors.New("already deleted") } + if nv.Size == 0 { + return 0, nil + } err := n.ReadData(v.dataFile, int64(nv.Offset)*NeedlePaddingSize, nv.Size, v.Version()) if err != nil { return 0, err