aboutsummaryrefslogtreecommitdiff
path: root/weed-fs/src
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2012-09-26 14:57:21 -0700
committerChris Lu <chris.lu@gmail.com>2012-09-26 14:57:21 -0700
commit46d13f6b5eb3faa6610857744ce98bb656f04a6c (patch)
tree47ae03e2bb4a96671599f67cfdc0e326b7462946 /weed-fs/src
parent20706d8cf267d893390ffe41f93ab684aca6eb25 (diff)
downloadseaweedfs-46d13f6b5eb3faa6610857744ce98bb656f04a6c.tar.xz
seaweedfs-46d13f6b5eb3faa6610857744ce98bb656f04a6c.zip
clean up unused options
cleaning error handling
Diffstat (limited to 'weed-fs/src')
-rw-r--r--weed-fs/src/cmd/weed/master.go1
-rw-r--r--weed-fs/src/cmd/weed/volume.go25
2 files changed, 12 insertions, 14 deletions
diff --git a/weed-fs/src/cmd/weed/master.go b/weed-fs/src/cmd/weed/master.go
index 5fdc80c20..8379642d9 100644
--- a/weed-fs/src/cmd/weed/master.go
+++ b/weed-fs/src/cmd/weed/master.go
@@ -29,7 +29,6 @@ var cmdMaster = &Command{
var (
mport = cmdMaster.Flag.Int("port", 9333, "http listen port")
metaFolder = cmdMaster.Flag.String("mdir", "/tmp", "data directory to store mappings")
- capacity = cmdMaster.Flag.Int("capacity", 100, "maximum number of volumes to hold")
volumeSizeLimitMB = cmdMaster.Flag.Uint("volumeSizeLimitMB", 32*1024, "Default Volume Size in MegaBytes")
mpulse = cmdMaster.Flag.Int("pulseSeconds", 5, "number of seconds between heartbeats")
confFile = cmdMaster.Flag.String("conf", "/etc/weedfs/weedfs.conf", "xml configuration file")
diff --git a/weed-fs/src/cmd/weed/volume.go b/weed-fs/src/cmd/weed/volume.go
index 5e35d6631..55fbe1f03 100644
--- a/weed-fs/src/cmd/weed/volume.go
+++ b/weed-fs/src/cmd/weed/volume.go
@@ -136,26 +136,26 @@ func PostHandler(w http.ResponseWriter, r *http.Request) {
errorStatus := ""
if ret > 0 || !store.HasVolume(volumeId) { //send to other replica locations
if r.FormValue("type") != "standard" {
- if distributedOperation(volumeId, func(location operation.Location) bool {
+ if !distributedOperation(volumeId, func(location operation.Location) bool {
_, err := operation.Upload("http://"+location.Url+r.URL.Path+"?type=standard", filename, bytes.NewReader(needle.Data))
return err == nil
}) {
- w.WriteHeader(http.StatusCreated)
- } else {
ret = 0
errorStatus = "Failed to write to replicas for volume " + volumeId.String()
w.WriteHeader(http.StatusInternalServerError)
}
- } else {
- w.WriteHeader(http.StatusCreated)
}
} else {
errorStatus = "Failed to write to local disk"
- w.WriteHeader(http.StatusInternalServerError)
}
m := make(map[string]interface{})
+ if errorStatus == "" {
+ w.WriteHeader(http.StatusCreated)
+ } else {
+ w.WriteHeader(http.StatusInternalServerError)
+ m["error"] = errorStatus
+ }
m["size"] = ret
- m["error"] = errorStatus
writeJson(w, r, m)
}
}
@@ -190,17 +190,16 @@ func DeleteHandler(w http.ResponseWriter, r *http.Request) {
if ret > 0 || !store.HasVolume(volumeId) { //send to other replica locations
if r.FormValue("type") != "standard" {
- if distributedOperation(volumeId, func(location operation.Location) bool {
+ if !distributedOperation(volumeId, func(location operation.Location) bool {
return nil == operation.Delete("http://"+location.Url+r.URL.Path+"?type=standard")
}) {
- w.WriteHeader(http.StatusCreated)
- } else {
ret = 0
- w.WriteHeader(http.StatusInternalServerError)
}
- } else {
- w.WriteHeader(http.StatusCreated)
}
+ }
+
+ if ret != 0 {
+ w.WriteHeader(http.StatusAccepted)
} else {
w.WriteHeader(http.StatusInternalServerError)
}