From 166a5fc524adf4c6736643a783d32f1170e01a14 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 12 Nov 2012 10:50:25 -0800 Subject: [PATCH] Issue 11: Failed to write to replicas for volumen 3 Fix displaying wrong error message --- weed-fs/src/cmd/weed/volume.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/weed-fs/src/cmd/weed/volume.go b/weed-fs/src/cmd/weed/volume.go index 2ff84f16b..6537cea13 100644 --- a/weed-fs/src/cmd/weed/volume.go +++ b/weed-fs/src/cmd/weed/volume.go @@ -147,6 +147,11 @@ func PostHandler(w http.ResponseWriter, r *http.Request) { ret := store.Write(volumeId, needle) errorStatus := "" needToReplicate := !store.HasVolume(volumeId) + if ret > 0 { + needToReplicate = needToReplicate || store.GetVolume(volumeId).NeedToReplicate() + }else{ + errorStatus = "Failed to write to local disk" + } if !needToReplicate && ret > 0 { needToReplicate = store.GetVolume(volumeId).NeedToReplicate() } @@ -160,8 +165,6 @@ func PostHandler(w http.ResponseWriter, r *http.Request) { errorStatus = "Failed to write to replicas for volume " + volumeId.String() } } - } else { - errorStatus = "Failed to write to local disk" } m := make(map[string]interface{}) if errorStatus == "" {