[sheepdog] [PATCH V2 2/4] collie: optimize 'collie vdi check' command

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Thu Aug 23 15:14:42 CEST 2012


At Tue, 21 Aug 2012 22:09:41 +0800,
Yunkai Zhang wrote:
> 
> From: Yunkai Zhang <qiushu.zyk at taobao.com>
> 
> V2:
> - use '-R, --repair' instread of '-F, --force_repair'
> - not connect to target sheep directly

This patch still calculates the target nodes in collie, and the
gateway node is only working as a proxy.

If it is necessary to calculate the targets in collie, I think it's
better to send a SD_OP_TYPE_LOCAL (not SD_OP_TYPE_PEER) request
directly from collie.

> +
> +	/*
> +	 * Force repair the consistency of oid's replica
> +	 *
> +	 * FIXME: this fix is rather dumb, it just read the
> +	 * first copy and write it to other replica,
> +	 */
> +	fprintf(stderr, ">> repairing ...\n");
> +	addr_to_str(host, sizeof(host), tgt_vnodes[0]->nid.addr,
> +		    tgt_vnodes[0]->nid.port);
> +	for (i = 1; i < nr_copies; i++) {
> +		char dest[128];
> +		addr_to_str(dest, sizeof(dest), tgt_vnodes[i]->nid.addr,
> +			    tgt_vnodes[i]->nid.port);
> +		fprintf(stderr, ">> copy this object from %s => %s\n",
> +			host, dest);
> +		do_repair(oid, &tgt_vnodes[0]->nid, &tgt_vnodes[i]->nid);
> +	}
> +	fprintf(stderr, ">> repair finished\n");
> +	return -1;
>  }

The following looks simpler:
 - collie sends a SD_OP_REPAIR request to one of the sheep nodes
 - the node sends SD_OP_WRITE_PEER requests to the other sheeps to fix
   consistency.

Thanks,

Kazutaka



More information about the sheepdog mailing list