[sheepdog] [PATCH 2/4] Revert "sheep: do the real work of dsiable/enable recovery"
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Tue Sep 11 10:25:30 CEST 2012
It requires quite big changes to extend this patch to handle leave
nodes. The next patch will implements manual recovery with much
simpler approach.
This reverts commit a9186fd8f0e133ba7065a579da1062650991e89a.
Conflicts:
sheep/group.c
sheep/sheep_priv.h
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
include/internal_proto.h | 1 -
sheep/group.c | 75 +++++++++------------------------------------
sheep/ops.c | 22 -------------
sheep/sheep_priv.h | 7 ----
4 files changed, 15 insertions(+), 90 deletions(-)
diff --git a/include/internal_proto.h b/include/internal_proto.h
index f894d00..3d1f99e 100644
--- a/include/internal_proto.h
+++ b/include/internal_proto.h
@@ -202,7 +202,6 @@ struct join_message {
uint32_t epoch;
uint64_t ctime;
uint8_t inc_epoch; /* set non-zero when we increment epoch of all nodes */
- uint8_t disable_recovery;
uint8_t store[STORE_LEN];
/*
diff --git a/sheep/group.c b/sheep/group.c
index 4661110..0a3fe08 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -45,11 +45,6 @@ pthread_mutex_t wait_vdis_lock = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t wait_vdis_cond = PTHREAD_COND_INITIALIZER;
static int is_vdi_list_ready = 1;
-struct sd_node joining_nodes[SD_MAX_NODES];
-size_t nr_joining_nodes;
-struct sd_node all_nodes[SD_MAX_NODES];
-size_t nr_all_nodes;
-
static struct vnode_info *current_vnode_info;
static size_t get_join_message_size(struct join_message *jm)
@@ -154,17 +149,6 @@ struct vnode_info *get_vnode_info(void)
}
/*
- * update currently active vnode information structure,
- * this must only be called from the main thread.
- */
-void update_vnode_info(struct vnode_info *vnode_info)
-{
-
- put_vnode_info(current_vnode_info);
- current_vnode_info = vnode_info;
-}
-
-/*
* Release a reference to the current vnode information.
*
* Must be called from the main thread.
@@ -179,7 +163,7 @@ void put_vnode_info(struct vnode_info *vnode_info)
}
}
-struct vnode_info *alloc_vnode_info(struct sd_node *nodes,
+static struct vnode_info *alloc_vnode_info(struct sd_node *nodes,
size_t nr_nodes)
{
struct vnode_info *vnode_info;
@@ -465,7 +449,7 @@ static void format_exceptional_node_list(struct join_message *jm)
jm->nodes[jm->nr_failed_nodes + jm->nr_delayed_nodes++] = n->ent;
}
-void clear_exceptional_node_lists(void)
+static void clear_exceptional_node_lists(void)
{
struct node *n, *t;
@@ -798,24 +782,6 @@ void wait_get_vdis_done(void)
dprintf("vdi list ready\n");
}
-static void prepare_recovery(struct sd_node *joined,
- struct sd_node *nodes, size_t nr_nodes)
-{
- int i;
-
- joining_nodes[nr_joining_nodes++] = *joined;
- if (!nr_all_nodes) {
- /* exclude the newly added one */
- for (i = 0; i < nr_nodes; i++) {
- if (!node_eq(nodes + i, joined))
- all_nodes[nr_all_nodes++] = nodes[i];
- }
- }
-
- if (!current_vnode_info)
- current_vnode_info = alloc_vnode_info(all_nodes, nr_all_nodes);
-}
-
void recalculate_vnodes(struct sd_node *nodes, int nr_nodes)
{
int i, nr_non_gateway_nodes = 0;
@@ -846,20 +812,16 @@ static void update_cluster_info(struct join_message *msg,
struct sd_node *joined, struct sd_node *nodes,
size_t nr_nodes)
{
- struct vnode_info *old_vnode_info = NULL;
+ struct vnode_info *old_vnode_info;
eprintf("status = %d, epoch = %d, finished: %d\n", msg->cluster_status,
msg->epoch, sys->join_finished);
- 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);
- }
+ old_vnode_info = current_vnode_info;
+ current_vnode_info = alloc_vnode_info(nodes, nr_nodes);
switch (msg->cluster_status) {
case SD_STATUS_OK:
@@ -883,21 +845,16 @@ static void update_cluster_info(struct join_message *msg,
sys->status = msg->cluster_status;
if (msg->inc_epoch) {
- if (!sys->disable_recovery) {
- uatomic_inc(&sys->epoch);
- log_current_epoch();
- clear_exceptional_node_lists();
-
- if (!old_vnode_info) {
- old_vnode_info =
- alloc_old_vnode_info(joined,
- nodes, nr_nodes);
- }
-
- start_recovery(current_vnode_info,
- old_vnode_info);
- } else
- prepare_recovery(joined, nodes, nr_nodes);
+ uatomic_inc(&sys->epoch);
+ log_current_epoch();
+ clear_exceptional_node_lists();
+
+ if (!old_vnode_info) {
+ old_vnode_info = alloc_old_vnode_info(joined,
+ nodes, nr_nodes);
+ }
+
+ start_recovery(current_vnode_info, old_vnode_info);
}
if (have_enough_zones())
@@ -978,7 +935,6 @@ enum cluster_join_result sd_check_join_cb(struct sd_node *joining, void *opaque)
vprintf(SDOG_DEBUG, "%s\n", node_to_str(&sys->this_node));
jm->cluster_status = sys->status;
- jm->disable_recovery = sys->disable_recovery;
epoch = get_latest_epoch();
if (!epoch)
@@ -1003,7 +959,6 @@ enum cluster_join_result sd_check_join_cb(struct sd_node *joining, void *opaque)
}
jm->cluster_status = sys->status;
- jm->disable_recovery = sys->disable_recovery;
jm->inc_epoch = 0;
switch (sys->status) {
diff --git a/sheep/ops.c b/sheep/ops.c
index ad7766a..213e3eb 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -317,28 +317,6 @@ static int cluster_shutdown(const struct sd_req *req, struct sd_rsp *rsp,
static int cluster_enable_recover(const struct sd_req *req,
struct sd_rsp *rsp, void *data)
{
- int i;
- struct vnode_info *old_vnode_info, *vnode_info;
-
- if (nr_joining_nodes) {
-
- for (i = 0; i < nr_joining_nodes; i++)
- all_nodes[nr_all_nodes++] = joining_nodes[i];
-
- old_vnode_info = get_vnode_info();
- vnode_info = alloc_vnode_info(all_nodes, nr_all_nodes);
- update_vnode_info(vnode_info);
-
- uatomic_inc(&sys->epoch);
- log_current_epoch();
- clear_exceptional_node_lists();
-
- start_recovery(vnode_info, old_vnode_info);
-
- put_vnode_info(old_vnode_info);
- }
-
- nr_joining_nodes = 0;
sys->disable_recovery = 0;
return SD_RES_SUCCESS;
}
diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h
index 6eb7e2c..bb7f5fe 100644
--- a/sheep/sheep_priv.h
+++ b/sheep/sheep_priv.h
@@ -205,10 +205,6 @@ extern char *jrnl_path;
extern char *epoch_path;
extern mode_t def_fmode;
extern mode_t def_dmode;
-extern struct sd_node joining_nodes[];
-extern size_t nr_joining_nodes;
-extern struct sd_node all_nodes[];
-extern size_t nr_all_nodes;
/* One should call this function to get sys->epoch outside main thread */
static inline uint32_t sys_epoch(void)
@@ -246,11 +242,8 @@ int local_get_node_list(const struct sd_req *req, struct sd_rsp *rsp,
void *data);
bool have_enough_zones(void);
-void clear_exceptional_node_lists(void);
struct vnode_info *grab_vnode_info(struct vnode_info *vnode_info);
struct vnode_info *get_vnode_info(void);
-void update_vnode_info(struct vnode_info *vnode_info);
-struct vnode_info *alloc_vnode_info(struct sd_node *nodes, size_t nr_nodes);
void put_vnode_info(struct vnode_info *vinfo);
struct vnode_info *get_vnode_info_epoch(uint32_t epoch);
void wait_get_vdis_done(void);
--
1.7.2.5
More information about the sheepdog
mailing list