From 4e48f64512d3f6fdbab17e777fff3fe191592a76 Mon Sep 17 00:00:00 2001
From: hxiaodon <huoxd_buaa@hotmail.com>
Date: Mon, 28 Dec 2015 14:23:26 +0800
Subject: [PATCH] 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())