[Sheepdog] [PATCH 2/4] sheep: transient failure - parameter changes

huxinwei huxinwei at huawei.com
Wed Mar 7 02:31:40 CET 2012


> -----Original Message-----
> From: sheepdog-bounces at lists.wpkg.org
> [mailto:sheepdog-bounces at lists.wpkg.org] On Behalf Of
> yaohaiting.wujue at gmail.com
> Sent: Tuesday, March 06, 2012 6:52 PM
> To: sheepdog at lists.wpkg.org
> Cc: HaiTing Yao
> Subject: [Sheepdog] [PATCH 2/4] sheep: transient failure - parameter changes
> 
> From: HaiTing Yao <wujue.yht at taobao.com>
> 
> Add one parameter, user can specify the time one node leave then join
> again.
> 
> -t, --templeft          specify the time(in seconds) node can leave then
> join again

What if some/all sheeps have different timeout setting?

I think it'll better to make it a cluster wide parameter.
Maybe another subcommand for collie ?

> If do not use this parameter, the sheep works without transient failure
> detection as before
> 
> Signed-off-by: HaiTing Yao <wujue.yht at taobao.com>
> ---
>  sheep/sheep.c |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/sheep/sheep.c b/sheep/sheep.c
> index b3b834b..63c53be 100644
> --- a/sheep/sheep.c
> +++ b/sheep/sheep.c
> @@ -38,11 +38,12 @@ static struct option const long_options[] = {
>  	{"zone", required_argument, NULL, 'z'},
>  	{"vnodes", required_argument, NULL, 'v'},
>  	{"cluster", required_argument, NULL, 'c'},
> +	{"templeft", required_argument, NULL, 't'},
>  	{"help", no_argument, NULL, 'h'},
>  	{NULL, 0, NULL, 0},
>  };
> 
> -static const char *short_options = "p:fl:dDz:v:c:h";
> +static const char *short_options = "p:fl:dDz:v:c:t:h";
> 
>  static void usage(int status)
>  {
> @@ -62,6 +63,7 @@ Options:\n\
>    -z, --zone              specify the zone id\n\
>    -v, --vnodes            specify the number of virtual nodes\n\
>    -c, --cluster           specify the cluster driver\n\
> +  -t, --templeft          specify the time(in seconds) node can leave then
> join again\n\
>    -h, --help              display this help and exit\n\
>  ", PACKAGE_VERSION, program_name);
>  	exit(status);
> @@ -98,6 +100,8 @@ int main(int argc, char **argv)
>  	char *p;
>  	struct cluster_driver *cdrv;
> 
> +	memset(sys, 0, sizeof(struct cluster_info));
> +
>  	signal(SIGPIPE, SIG_IGN);
> 
>  	while ((ch = getopt_long(argc, argv, short_options, long_options,
> @@ -165,6 +169,9 @@ int main(int argc, char **argv)
> 
>  			sys->cdrv_option = get_cdrv_option(sys->cdrv, optarg);
>  			break;
> +		case 't':
> +			sys->templeft_time = atoi(optarg);
> +			break;
>  		case 'h':
>  			usage(0);
>  			break;
> --
> 1.7.1
> 
> --
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog



More information about the sheepdog mailing list