[Sheepdog] [PATCH] sheep: cpg_local_get() should be called before cpg_join()

zituan at taobao.com zituan at taobao.com
Thu Sep 29 07:46:18 CEST 2011


From: Yibin Shen <zituan at taobao.com>


Signed-off-by: Yibin Shen <zituan at taobao.com>
---
 sheep/group.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/sheep/group.c b/sheep/group.c
index 38fc43a..80a8f54 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -1990,6 +1990,12 @@ int create_cluster(int port, int64_t zone)
 		return -1;
 	}
 
+	ret = cpg_local_get(cpg_handle, &nodeid);
+	if (ret != CPG_OK) {
+		eprintf("Failed to get the local node's identifier, %d\n", ret);
+		return 1;
+	}
+
 join_retry:
 	ret = cpg_join(cpg_handle, &group);
 	switch (ret) {
@@ -2007,12 +2013,6 @@ join_retry:
 		return -1;
 	}
 
-	ret = cpg_local_get(cpg_handle, &nodeid);
-	if (ret != CPG_OK) {
-		eprintf("Failed to get the local node's identifier, %d\n", ret);
-		return 1;
-	}
-
 	sys->handle = cpg_handle;
 	sys->this_nodeid = nodeid;
 	sys->this_pid = getpid();
-- 
1.7.6.3




More information about the sheepdog mailing list