[sheepdog] [PATCH] zookeeper: increase nr_zk_nodes only when added into btree successfully

Yunkai Zhang yunkai.me at gmail.com
Mon Jul 9 04:21:52 CEST 2012


From: Yunkai Zhang <qiushu.zyk at taobao.com>


Signed-off-by: Yunkai Zhang <qiushu.zyk at taobao.com>
---
 sheep/cluster/zookeeper.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sheep/cluster/zookeeper.c b/sheep/cluster/zookeeper.c
index 4c07a3d..7bd20bd 100644
--- a/sheep/cluster/zookeeper.c
+++ b/sheep/cluster/zookeeper.c
@@ -349,8 +349,8 @@ static void node_btree_add(void **btroot, struct zk_node *znode)
 	else if (*p != n) {
 		**p = *n;
 		free(n);
-	}
-	nr_zk_nodes++;
+	} else
+		nr_zk_nodes++;
 }
 
 static inline void node_btree_del(void **btroot, struct zk_node *znode)
-- 
1.7.10.4




More information about the sheepdog mailing list