[sheepdog] [PATCH v2] zookeeper: clean up sd_iprintf and sd_eprintf

Liu Yuan namei.unix at gmail.com
Thu Jul 4 10:24:24 CEST 2013


These information aren't useful for users.

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 sheep/cluster/zookeeper.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sheep/cluster/zookeeper.c b/sheep/cluster/zookeeper.c
index aafc18d..0feb8cf 100644
--- a/sheep/cluster/zookeeper.c
+++ b/sheep/cluster/zookeeper.c
@@ -146,6 +146,8 @@ static struct zk_node this_node;
 	switch (rc) {							\
 	case ZNONODE:							\
 	case ZNODEEXISTS:						\
+		sd_dprintf("failed, path:%s, %s", path, zerror(rc));	\
+		break;							\
 	case ZINVALIDSTATE:						\
 	case ZSESSIONEXPIRED:						\
 	case ZOPERATIONTIMEOUT:						\
@@ -735,7 +737,7 @@ static void zk_compete_master(void)
 		goto out_unlock;
 
 	if (!joined) {
-		sd_iprintf("start to compete master for the first time");
+		sd_dprintf("start to compete master for the first time");
 		do {
 			if (uatomic_is_true(&stop))
 				goto out_unlock;
@@ -761,7 +763,7 @@ static void zk_compete_master(void)
 	if (!strcmp(master_name, node_to_str(&this_node.node)))
 		goto success;
 	else if (joined) {
-		sd_iprintf("lost");
+		sd_dprintf("lost");
 		goto out_unlock;
 	} else {
 		if (zk_verify_last_sheep_join(my_seq,
@@ -773,13 +775,13 @@ static void zk_compete_master(void)
 			master_seq = my_seq;
 			goto success;
 		} else {
-			sd_iprintf("lost");
+			sd_dprintf("lost");
 			goto out_unlock;
 		}
 	}
 success:
 	uatomic_set_true(&is_master);
-	sd_iprintf("success");
+	sd_dprintf("success");
 out_unlock:
 	pthread_rwlock_unlock(&zk_compete_master_lock);
 }
-- 
1.7.9.5




More information about the sheepdog mailing list