diff options
| author | Chris Lu <chris.lu@gmail.com> | 2013-07-10 00:25:14 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2013-07-10 00:25:14 -0700 |
| commit | 4c200acd7dd663bed5f566c5538114ef66e5cbe3 (patch) | |
| tree | 7c186175c22a45d8346ce02ad6fb61766e2876c3 /go/replication | |
| parent | 53b6831f73ffcf4dcb6cbf6fdff0d7e60389745c (diff) | |
| download | seaweedfs-4c200acd7dd663bed5f566c5538114ef66e5cbe3.tar.xz seaweedfs-4c200acd7dd663bed5f566c5538114ef66e5cbe3.zip | |
1. ensure replicated file has the same timestamp
2. upload can specify modified time by &ts=...
3. correctly return code 304
Diffstat (limited to 'go/replication')
| -rw-r--r-- | go/replication/store_replicate.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/go/replication/store_replicate.go b/go/replication/store_replicate.go index 8306a31b4..f6e84e2ef 100644 --- a/go/replication/store_replicate.go +++ b/go/replication/store_replicate.go @@ -23,9 +23,9 @@ func ReplicatedWrite(masterNode string, s *storage.Store, volumeId storage.Volum needToReplicate = s.GetVolume(volumeId).NeedToReplicate() } if needToReplicate { //send to other replica locations - if r.FormValue("type") != "standard" { + if r.FormValue("type") != "replicate" { if !distributedOperation(masterNode, s, volumeId, func(location operation.Location) bool { - _, err := operation.Upload("http://"+location.Url+r.URL.Path+"?type=standard", string(needle.Name), bytes.NewReader(needle.Data)) + _, err := operation.Upload("http://"+location.Url+r.URL.Path+"?type=replicate&ts="+strconv.FormatUint(needle.LastModified,10), string(needle.Name), bytes.NewReader(needle.Data)) return err == nil }) { ret = 0 @@ -39,7 +39,7 @@ func ReplicatedWrite(masterNode string, s *storage.Store, volumeId storage.Volum volumeId.String() + ": " + err.Error() } else { distributedOperation(masterNode, s, volumeId, func(location operation.Location) bool { - return nil == operation.Delete("http://"+location.Url+r.URL.Path+"?type=standard") + return nil == operation.Delete("http://"+location.Url+r.URL.Path+"?type=replicate") }) } } @@ -59,9 +59,9 @@ func ReplicatedDelete(masterNode string, store *storage.Store, volumeId storage. needToReplicate = store.GetVolume(volumeId).NeedToReplicate() } if needToReplicate { //send to other replica locations - if r.FormValue("type") != "standard" { + if r.FormValue("type") != "replicate" { if !distributedOperation(masterNode, store, volumeId, func(location operation.Location) bool { - return nil == operation.Delete("http://"+location.Url+r.URL.Path+"?type=standard") + return nil == operation.Delete("http://"+location.Url+r.URL.Path+"?type=replicate") }) { ret = 0 } |
