[sheepdog] [PATCH v4 08/12] gateway: don't skip start_recovery for gateway-only node
MORITA Kazutaka
morita.kazutaka at gmail.com
Mon May 27 18:10:02 CEST 2013
At Mon, 27 May 2013 23:04:18 +0800,
Liu Yuan wrote:
>
> On 05/27/2013 10:53 PM, MORITA Kazutaka wrote:
> > I think we should set rinfo->state to RW_NOTIFY_COMPLETION to skip
> > gathering object lists.
>
> I tried so, but can't pass 63. I don't investigate it yet.
It is because rinfo is not freed and 'cluster node recovery' doesn't
say that the gateway node finishes recovery.
I didn't come up with a clean approach, but it looks the simplest way
to me to exit prepare_object_list() without sending SD_OP_GET_OBJ_LIST
when the node is gateway.
diff --git a/sheep/recovery.c b/sheep/recovery.c
index 5fad1fa..9c9acc1 100644
--- a/sheep/recovery.c
+++ b/sheep/recovery.c
@@ -739,6 +739,11 @@ static void screen_object_list(struct recovery_list_work *rlw,
xqsort(rlw->oids, rlw->count, obj_cmp);
}
+static inline bool node_is_gateway_only(void)
+{
+ return sys->this_node.nr_vnodes == 0;
+}
+
/* Prepare the object list that belongs to this node */
static void prepare_object_list(struct work *work)
{
@@ -752,6 +757,9 @@ static void prepare_object_list(struct work *work)
int start = random() % cur_nr, i, end = cur_nr;
uint64_t *oids;
+ if (node_is_gateway_only())
+ return;
+
sd_dprintf("%u", rw->epoch);
wait_get_vdis_done();
again:
@@ -781,20 +789,12 @@ again:
sd_dprintf("%d", rlw->count);
}
-static inline bool node_is_gateway_only(void)
-{
- return sys->this_node.nr_vnodes == 0;
-}
-
int start_recovery(struct vnode_info *cur_vinfo, struct vnode_info *old_vinfo,
bool epoch_lifted)
{
struct recovery_info *rinfo;
uint32_t old_epoch = epoch_lifted ? sys->epoch - 1 : sys->epoch;
- if (node_is_gateway_only())
- goto out;
-
rinfo = xzalloc(sizeof(struct recovery_info));
rinfo->state = RW_PREPARE_LIST;
rinfo->epoch = sys->epoch;
@@ -826,7 +826,7 @@ int start_recovery(struct vnode_info *cur_vinfo, struct vnode_info *old_vinfo,
main_thread_set(current_rinfo, rinfo);
queue_recovery_work(rinfo);
}
-out:
+
wakeup_requests_on_epoch();
return 0;
}
More information about the sheepdog
mailing list