From 688b99eb73a09595d6401f26c4fd02d7af5fa767 Mon Sep 17 00:00:00 2001 From: Mohanson Date: Fri, 25 Dec 2015 14:47:33 +0800 Subject: [PATCH 1/5] add Introductions of scale of image --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 7ef2a72b8..f79b3c44d 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,12 @@ If you want a nicer URL, you can use one of these alternative URL formats: http://localhost:8080/3,01637037d6 ``` +If you want get an scale of image, you can add some params: + +``` +http://localhost:8080/3/01637037d6.jpg?height=200&width=200 +``` + ### Rack-Aware and Data Center-Aware Replication ### SeaweedFS apply the replication strategy on a volume level. So when you are getting a file id, you can specify the replication strategy. For example: From 3c9ef6245ec212711a4588fd094828f1e6aa81fd Mon Sep 17 00:00:00 2001 From: Mohanson Date: Fri, 25 Dec 2015 16:32:50 +0800 Subject: [PATCH 2/5] fix bug : master cann't redirect urlquery string There is a bug that master can not redirect urlquery to slave volumn. so i fix it, and it run good now. --- go/weed/weed_server/master_server_handlers_admin.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/go/weed/weed_server/master_server_handlers_admin.go b/go/weed/weed_server/master_server_handlers_admin.go index fb2b18983..7893a5765 100644 --- a/go/weed/weed_server/master_server_handlers_admin.go +++ b/go/weed/weed_server/master_server_handlers_admin.go @@ -123,7 +123,13 @@ func (ms *MasterServer) redirectHandler(w http.ResponseWriter, r *http.Request) } machines := ms.Topo.Lookup("", volumeId) if machines != nil && len(machines) > 0 { - http.Redirect(w, r, util.NormalizeUrl(machines[rand.Intn(len(machines))].PublicUrl)+r.URL.Path, http.StatusMovedPermanently) + var url string + if r.URL.RawQuery != "" { + url = util.NormalizeUrl(machines[rand.Intn(len(machines))].PublicUrl) + r.URL.Path + "?" + r.URL.RawQuery + } else { + url = util.NormalizeUrl(machines[rand.Intn(len(machines))].PublicUrl) + r.URL.Path + } + http.Redirect(w, r, url, http.StatusMovedPermanently) } else { writeJsonError(w, r, http.StatusNotFound, fmt.Errorf("volume id %d not found", volumeId)) } From 4e48f64512d3f6fdbab17e777fff3fe191592a76 Mon Sep 17 00:00:00 2001 From: hxiaodon Date: Mon, 28 Dec 2015 14:23:26 +0800 Subject: [PATCH 3/5] Update store_replicate.go replication operations should be equal to volume's replication setting --- go/topology/store_replicate.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/go/topology/store_replicate.go b/go/topology/store_replicate.go index dc26dade0..4adb4431e 100644 --- a/go/topology/store_replicate.go +++ b/go/topology/store_replicate.go @@ -95,6 +95,13 @@ func distributedOperation(masterNode string, store *storage.Store, volumeId stor for i := 0; i < length; i++ { ret = ret && <-results } + if volume := store.GetVolume(volumeId); volume != nil { + copyCount := volume.ReplicaPlacement.GetCopyCount() - 1 + if length < copyCount { + glog.V(0).Infoln("replicating opetations [%d] is less than volume's replication copy count [%d]", length, copyCount) + ret = false + } + } return ret } else { glog.V(0).Infoln("Failed to lookup for", volumeId, lookupErr.Error()) From 6c88abf62f9e2a03f782753fc236b790681714e6 Mon Sep 17 00:00:00 2001 From: chrislusf Date: Wed, 30 Dec 2015 22:48:19 -0800 Subject: [PATCH 4/5] adjust print out when error --- go/topology/store_replicate.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/go/topology/store_replicate.go b/go/topology/store_replicate.go index 4adb4431e..a4be4726f 100644 --- a/go/topology/store_replicate.go +++ b/go/topology/store_replicate.go @@ -96,12 +96,11 @@ func distributedOperation(masterNode string, store *storage.Store, volumeId stor ret = ret && <-results } if volume := store.GetVolume(volumeId); volume != nil { - copyCount := volume.ReplicaPlacement.GetCopyCount() - 1 - if length < copyCount { - glog.V(0).Infoln("replicating opetations [%d] is less than volume's replication copy count [%d]", length, copyCount) + if length+1 < volume.ReplicaPlacement.GetCopyCount() { + glog.V(0).Infof("replicating opetations [%d] is less than volume's replication copy count [%d]", length+1, volume.ReplicaPlacement.GetCopyCount()) ret = false } - } + } return ret } else { glog.V(0).Infoln("Failed to lookup for", volumeId, lookupErr.Error()) From 166cc0d48a389be2f6120e3fafda9563309dcf34 Mon Sep 17 00:00:00 2001 From: Xiaodong Huo Date: Mon, 4 Jan 2016 09:52:32 +0800 Subject: [PATCH 5/5] collection name could be specified in url uploading file with filer service could specify the collection name in get/post field, if no collection specified, the default collection setting against the filer service will be used --- go/weed/weed_server/filer_server_handlers.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/go/weed/weed_server/filer_server_handlers.go b/go/weed/weed_server/filer_server_handlers.go index 1695296d4..e6f1628da 100644 --- a/go/weed/weed_server/filer_server_handlers.go +++ b/go/weed/weed_server/filer_server_handlers.go @@ -130,7 +130,11 @@ func (fs *FilerServer) PostHandler(w http.ResponseWriter, r *http.Request) { if replication == "" { replication = fs.defaultReplication } - assignResult, ae := operation.Assign(fs.master, 1, replication, fs.collection, query.Get("ttl")) + collection := query.Get("collection") + if collection == "" { + collection = fs.collection + } + assignResult, ae := operation.Assign(fs.master, 1, replication, collection, query.Get("ttl")) if ae != nil { glog.V(0).Infoln("failing to assign a file id", ae.Error()) writeJsonError(w, r, http.StatusInternalServerError, ae)