[sheepdog] [PATCH] sheep: the joiner should exit when in CJ_RES_JOIN_LATER

Yunkai Zhang yunkai.me at gmail.com
Fri Jul 27 12:50:23 CEST 2012


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

When joiner's epoch less than master's epoch, CJ_RES_JOIN_LATER will be
return in join event's response, just like CJ_RES_JOIN_LATER's literal meaning,
the joiner should exit at this time.

We can restart it again after the cluster start working(status become OK).

Signed-off-by: Yunkai Zhang <qiushu.zyk at taobao.com>
---
 sheep/group.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sheep/group.c b/sheep/group.c
index f7c8ca7..cb63454 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -1006,7 +1006,7 @@ void sd_join_handler(struct sd_node *joined, struct sd_node *members,
 	uint32_t le = get_latest_epoch();
 
 	if (node_eq(joined, &sys->this_node)) {
-		if (result == CJ_RES_FAIL) {
+		if (result == CJ_RES_FAIL || result == CJ_RES_JOIN_LATER) {
 			eprintf("Failed to join, exiting.\n");
 			sys->cdrv->leave();
 			exit(1);
-- 
1.7.11.2




More information about the sheepdog mailing list