At Wed,  1 Aug 2012 10:56:15 +0800,
levin li wrote:
> 
> From: levin li <[email protected]>
> 
> When epoch changes, new node join or old node leave, we should
> recalculate the vnode_info for every sd_node, and the disk space
> is stored in sd_node, transfered to every other node together with
> join message.
> 
> Signed-off-by: levin li <[email protected]>
> ---
>  include/internal_proto.h |    1 +
>  sheep/group.c            |   24 ++++++++++++++++++++++++
>  2 files changed, 25 insertions(+), 0 deletions(-)
> 
> diff --git a/include/internal_proto.h b/include/internal_proto.h
> index 3e22124..d48c8af 100644
> --- a/include/internal_proto.h
> +++ b/include/internal_proto.h
> @@ -174,6 +174,7 @@ struct sd_node {
>       struct node_id  nid;
>       uint16_t        nr_vnodes;
>       uint32_t        zone;
> +     uint32_t        space;
>  };

Please increment SD_SHEEP_PROTO_VER when changing this structure.


>  static void update_cluster_info(struct join_message *msg,
>                               struct sd_node *joined, struct sd_node *nodes,
>                               size_t nr_nodes)
> @@ -784,6 +802,8 @@ static void update_cluster_info(struct join_message *msg,
>       if (!sys->join_finished)
>               finish_join(msg, joined, nodes, nr_nodes);
>  
> +     recalculate_vnodes(nodes, nr_nodes);
> +
>       old_vnode_info = current_vnode_info;
>       current_vnode_info = alloc_vnode_info(nodes, nr_nodes);

IIUC, This recalculation should be done only when
sys->disable_recovery is false.  In addition, you need to recalculate
vnodes when automatic object recovery is turned on in
cluster_enable_recover().

Thanks,

Kazutaka
-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to