diff --git a/weed/storage/volume_write.go b/weed/storage/volume_write.go index 2dc813216..2e0fc4de1 100644 --- a/weed/storage/volume_write.go +++ b/weed/storage/volume_write.go @@ -213,13 +213,17 @@ func (v *Volume) doDeleteRequest(n *needle.Needle) (Size, error) { nv, ok := v.nm.Get(n.Id) // fmt.Println("key", n.Id, "volume offset", nv.Offset, "data_size", n.Size, "cached size", nv.Size) if ok && nv.Size.IsValid() { - size := nv.Size - n.Data = nil - n.AppendAtNs = uint64(time.Now().UnixNano()) - offset, _, _, err := n.Append(v.DataBackend, v.Version()) - v.checkReadWriteError(err) - if err != nil { - return size, err + var offset uint64 + var err error + if !v.hasRemoteFile { + size := nv.Size + n.Data = nil + n.AppendAtNs = uint64(time.Now().UnixNano()) + offset, _, _, err = n.Append(v.DataBackend, v.Version()) + v.checkReadWriteError(err) + if err != nil { + return size, err + } } v.lastAppendAtNs = n.AppendAtNs if err = v.nm.Delete(n.Id, ToOffset(int64(offset))); err != nil {