[sheepdog] [PATCH 3/4] sheep: recalculate the vnodes number when epoch changes

levin li levin108 at gmail.com
Fri Aug 3 08:11:16 CEST 2012


On 2012年08月03日 14:08, MORITA Kazutaka wrote:
> At Wed,  1 Aug 2012 10:56:15 +0800,
> levin li wrote:
>>
>> From: levin li <xingke.lwp at taobao.com>
>>
>> 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 <xingke.lwp at taobao.com>
>> ---
>>  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.
> 

OK

> 
>>  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
> 

I'll rebase this patch since the delay recovery patchset was merged.

thanks

levin



More information about the sheepdog mailing list