From a9a336fdff076211e7c94a4243b430219e5d891c Mon Sep 17 00:00:00 2001 From: tnextday Date: Wed, 2 Dec 2015 21:45:26 +0800 Subject: [PATCH] delete file return needle size --- go/weed/weed_server/volume_server_handlers_write.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/go/weed/weed_server/volume_server_handlers_write.go b/go/weed/weed_server/volume_server_handlers_write.go index 9aa998c3c..c891b5af7 100644 --- a/go/weed/weed_server/volume_server_handlers_write.go +++ b/go/weed/weed_server/volume_server_handlers_write.go @@ -53,9 +53,8 @@ func (vs *VolumeServer) DeleteHandler(w http.ResponseWriter, r *http.Request) { glog.V(2).Infoln("deleting", n) cookie := n.Cookie - count, ok := vs.store.ReadVolumeNeedle(volumeId, n) - if ok != nil { + if _, ok := vs.store.ReadVolumeNeedle(volumeId, n); ok != nil { m := make(map[string]uint32) m["size"] = 0 writeJsonQuiet(w, r, http.StatusNotFound, m) @@ -66,6 +65,9 @@ func (vs *VolumeServer) DeleteHandler(w http.ResponseWriter, r *http.Request) { glog.V(0).Infoln("delete", r.URL.Path, "with unmaching cookie from ", r.RemoteAddr, "agent", r.UserAgent()) return } + + count := int64(n.Size) + if n.IsChunkedManifest(){ chunkManifest, e := operation.LoadChunkManifest(n.Data, n.IsGzipped()) if e != nil { @@ -82,8 +84,8 @@ func (vs *VolumeServer) DeleteHandler(w http.ResponseWriter, r *http.Request) { ret := topology.ReplicatedDelete(vs.GetMasterNode(), vs.store, volumeId, n, r) if ret != 0 { - m := make(map[string]uint32) - m["size"] = uint32(count) + m := make(map[string]int64) + m["size"] = count writeJsonQuiet(w, r, http.StatusAccepted, m) } else { writeJsonError(w, r, http.StatusInternalServerError, errors.New("Deletion Failed."))