[sheepdog] [PATCH v2 08/11] group: add node to sockfd_cache as early as possible

Hitoshi Mitake mitake.hitoshi at gmail.com
Tue Sep 17 17:34:36 CEST 2013


At Sat, 14 Sep 2013 18:34:28 +0800,
Liu Yuan wrote:
> 
> get_vdis will try to connect to all the nodes include joining node, so before
> calling get_vdis, we'd better add joining node in the sockfd cache. This is not
> a fatal problem and sockfd cache can actually sort it out with the old code, but
> this patch will safe us unnecessary revalidating node after grab failure.
> 
> Signed-off-by: Liu Yuan <namei.unix at gmail.com>
> ---
>  sheep/group.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/sheep/group.c b/sheep/group.c
> index 660fc5a..0b03150 100644
> --- a/sheep/group.c
> +++ b/sheep/group.c
> @@ -633,6 +633,7 @@ static void update_cluster_info(const struct cluster_info *cinfo,
>  
>  	if (node_is_local(joined))
>  		sockfd_cache_add_group(nroot);

We should add else here. If the joined node is local, the newly
created connections will not be useful.

> +	sockfd_cache_add(&joined->nid);
>  
>  	old_vnode_info = main_thread_get(current_vnode_info);
>  	main_thread_set(current_vnode_info, alloc_vnode_info(nroot));
> @@ -665,8 +666,6 @@ static void update_cluster_info(const struct cluster_info *cinfo,
>  	}
>  
>  	put_vnode_info(old_vnode_info);
> -
> -	sockfd_cache_add(&joined->nid);
>  }
>  
>  /*
> -- 
> 1.7.9.5

Thanks,
Hitoshi



More information about the sheepdog mailing list