[sheepdog] [PATCH v5 6/6] zookeeper: handle session timeout for all zookeeper operations

Kai Zhang kyle at zelin.io
Fri Jun 21 07:04:56 CEST 2013


Thanks for catching.
I will fix it.

Thanks,
Kyle


On Jun 21, 2013, at 11:55 AM, MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp> wrote:

> At Thu, 20 Jun 2013 12:00:22 -0700,
> Kai Zhang wrote:
>> 
>> @@ -365,19 +397,12 @@ static void zk_queue_pop_advance(struct zk_event *ev)
>> 	len = sizeof(*ev);
>> 	snprintf(path, sizeof(path), QUEUE_ZNODE "/%010"PRId32, queue_pos);
>> 	rc = zk_get_data(path, ev, &len);
>> -	if (rc != ZOK)
>> -		panic("failed to get data from %s, %s", path, zerror(rc));
>> -	sd_dprintf("%s, type:%d, len:%d, pos:%"PRId32, path, ev->type, len,
>> -		   queue_pos);
>> -	queue_pos++;
>> -}
>> -
>> -static int zk_member_empty(void)
>> -{
>> -	struct String_vector strs;
>> -
>> -	zk_get_children(MEMBER_ZNODE, &strs);
>> -	return (strs.count == 0);
>> +	if (rc == ZOK) {
>> +		sd_dprintf("%s, type:%d, len:%d, pos:%"PRId32, path, ev->type,
>> +			   len, queue_pos);
>> +		queue_pos++;
>> +	} else
>> +		sd_eprintf("failed, path %s, %s", path, zerror(rc));
>> }
> 
> With this change, this function can return without setting ev.
> However, the caller zk_event_handler() access the zk_event
> unconditionally.
> 
>> @@ -568,15 +611,17 @@ static void zk_get_least_seq(const char *parent, char *least_seq_path,
>> 
>> 		if (rc == ZOK) {
>> 			strncpy(least_seq_path, path, path_len);
>> -			break;
>> +			return ZOK;
>> 		} else if (rc == ZNONODE)
>> 			continue;
>> -		else
>> -			panic("failed, path:%s, %s", path, zerror(rc));
>> +		else {
>> +			sd_eprintf("failed, %s", zerror(rc));
>> +			return rc;
> 
> Same here.  This function can return without setting least_seq_path,
> but zk_find_master() doesn't check the return value of this function.
> 
> Thanks,
> 
> Kazutaka




More information about the sheepdog mailing list