Browse Source

shortcut for empty file

pull/821/head
Chris Lu 6 years ago
parent
commit
badd8fdf8f
  1. 3
      weed/storage/volume_read_write.go

3
weed/storage/volume_read_write.go

@ -145,6 +145,9 @@ func (v *Volume) readNeedle(n *Needle) (int, error) {
if nv.Size == TombstoneFileSize { if nv.Size == TombstoneFileSize {
return -1, errors.New("already deleted") 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()) err := n.ReadData(v.dataFile, int64(nv.Offset)*NeedlePaddingSize, nv.Size, v.Version())
if err != nil { if err != nil {
return 0, err return 0, err

Loading…
Cancel
Save