diff options
| author | Chris Lu <chris.lu@gmail.com> | 2018-07-14 20:26:45 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2018-07-14 20:26:45 -0700 |
| commit | 85eae57e4ce9ffc3edce37baeb0fa35dec4d6c82 (patch) | |
| tree | 2b123f1d23abcfc4fd6e157e04b6fe699231c34c | |
| parent | 67763fb3751cc186c6054ef8150368e7e9d11601 (diff) | |
| download | seaweedfs-85eae57e4ce9ffc3edce37baeb0fa35dec4d6c82.tar.xz seaweedfs-85eae57e4ce9ffc3edce37baeb0fa35dec4d6c82.zip | |
Store and replicate timestamp of file deletion in tombstone marker
merging changes from https://github.com/chrislusf/seaweedfs/pull/609/files
| -rw-r--r-- | weed/server/volume_server_handlers_write.go | 12 |
1 files changed, 12 insertions, 0 deletions
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, |
