[sheepdog] [PATCH] sheep: set sys->epoch correctly before becoming master

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Sun May 20 16:39:20 CEST 2012


This fixes a bug introduced by commit 43a2f684e, and necessary to pass
the following testcase:

  #!/bin/bash
  set -ex

  for i in 0 1 2; do ./sheep/sheep /store/$i -z $i -p 700$i; sleep 1; done
  ./collie/collie cluster format
  for i in 0 1 2; do pkill -f "sheep /store/$i"; sleep 1; done
  for i in 1 0 2; do ./sheep/sheep /store/$i -z $i -p 700$i; sleep 1; done
  for i in 0 1 2; do ./sheep/sheep /store/$i -z $i -p 700$i; sleep 1; done
  for i in 0 1 2; do ./collie/collie cluster info -p 700$i; done

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 sheep/group.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/sheep/group.c b/sheep/group.c
index 7f3bedb..8207612 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -1263,6 +1263,7 @@ void sd_join_handler(struct sd_node *joined, struct sd_node *members,
 			sys->join_finished = 1;
 			assert(sys->nr_nodes == 0);
 			update_node_info(&sys->this_node, 1);
+			sys->epoch = get_latest_epoch();
 		}
 
 		nr_local = get_nodes_nr_epoch(sys->epoch);
-- 
1.7.2.5




More information about the sheepdog mailing list