[sheepdog] [PATCH 2/2] store: make objects stale when sheep starts

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Sat Aug 25 20:09:51 CEST 2012


It is unsafe to remove objects in the working directory when starting
sheeps because it is not sure that the objects are correctly recovered
to other nodes' working directory.  We should make them stale objects
rather than removing them.

This also initializes current_vnode_info before calling finish_join()
because default_purge_obj will be called in it.

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

diff --git a/sheep/group.c b/sheep/group.c
index ea5b9e6..5e764a4 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -844,14 +844,14 @@ static void update_cluster_info(struct join_message *msg,
 
 	sys->disable_recovery = msg->disable_recovery;
 
-	if (!sys->join_finished)
-		finish_join(msg, joined, nodes, nr_nodes);
-
 	if (!sys->disable_recovery) {
 		old_vnode_info = current_vnode_info;
 		current_vnode_info = alloc_vnode_info(nodes, nr_nodes);
 	}
 
+	if (!sys->join_finished)
+		finish_join(msg, joined, nodes, nr_nodes);
+
 	switch (msg->cluster_status) {
 	case SD_STATUS_OK:
 	case SD_STATUS_HALT:
diff --git a/sheep/plain_store.c b/sheep/plain_store.c
index 9eb2fb6..f4ccb7a 100644
--- a/sheep/plain_store.c
+++ b/sheep/plain_store.c
@@ -394,7 +394,7 @@ int default_remove_object(uint64_t oid)
 
 int default_purge_obj(void)
 {
-	return for_each_object_in_wd(default_remove_object);
+	return for_each_object_in_wd(move_object_to_stale_dir);
 }
 
 struct store_driver plain_store = {
-- 
1.7.2.5




More information about the sheepdog mailing list