diff --git a/weed/server/volume_server_handlers_write.go b/weed/server/volume_server_handlers_write.go index 3864ec903..55ef2a613 100644 --- a/weed/server/volume_server_handlers_write.go +++ b/weed/server/volume_server_handlers_write.go @@ -9,6 +9,8 @@ import ( "github.com/chrislusf/seaweedfs/weed/operation" "github.com/chrislusf/seaweedfs/weed/storage" "github.com/chrislusf/seaweedfs/weed/topology" + "time" + "strconv" ) func (vs *VolumeServer) PostHandler(w http.ResponseWriter, r *http.Request) { @@ -87,6 +89,14 @@ func (vs *VolumeServer) DeleteHandler(w http.ResponseWriter, r *http.Request) { count = chunkManifest.Size } + n.LastModified = uint64(time.Now().Unix()) + if len(r.FormValue("ts")) > 0 { + modifiedTime, err := strconv.ParseInt(r.FormValue("ts"), 10, 64) + if err == nil { + n.LastModified = uint64(modifiedTime) + } + } + _, err := topology.ReplicatedDelete(vs.GetMaster(), vs.store, volumeId, n, r) if err == nil { @@ -103,6 +113,7 @@ func (vs *VolumeServer) DeleteHandler(w http.ResponseWriter, r *http.Request) { func (vs *VolumeServer) batchDeleteHandler(w http.ResponseWriter, r *http.Request) { r.ParseForm() var ret []operation.DeleteResult + now := uint64(time.Now().Unix()) for _, fid := range r.Form["fid"] { vid, id_cookie, err := operation.ParseFileId(fid) if err != nil { @@ -144,6 +155,7 @@ func (vs *VolumeServer) batchDeleteHandler(w http.ResponseWriter, r *http.Reques glog.V(0).Infoln("deleting", fid, "with unmaching cookie from ", r.RemoteAddr, "agent", r.UserAgent()) return } + n.LastModified = now if size, err := vs.store.Delete(volumeId, n); err != nil { ret = append(ret, operation.DeleteResult{ Fid: fid,