[sheepdog] [PATCH v3] sheep: remove master node
Liu Yuan
namei.unix at gmail.com
Tue Jul 23 10:04:24 CEST 2013
On Tue, Jul 23, 2013 at 05:02:52PM +0900, MORITA Kazutaka wrote:
> At Tue, 23 Jul 2013 12:44:15 +0800,
> Liu Yuan wrote:
> >
> > > diff --git a/sheep/group.c b/sheep/group.c
> > > index 4a2a83b..054292d 100644
> > > --- a/sheep/group.c
> > > +++ b/sheep/group.c
> > > @@ -779,14 +779,22 @@ void sd_notify_handler(const struct sd_node *sender, void *data,
> > > * Accept the joining node and pass the cluster info to it.
> > > *
> > > * Note that 'nodes' doesn't contain 'joining'.
> > > + *
> > > + * Return true if the joining node is accepted. At least one nodes in the
> > > + * cluster must call this function and succeed in accept of the joining node.
> > > */
> > > -void sd_join_handler(const struct sd_node *joining,
> > > +bool sd_join_handler(const struct sd_node *joining,
> > > const struct sd_node *nodes, size_t nr_nodes,
> > > void *opaque)
> > > {
> > > struct join_message *jm = opaque;
> > > char str[MAX_NODE_STR_LEN];
> > >
> > > + if (nr_nodes > 0 && node_is_local(joining)) {
> > > + sd_dprintf("wait for another node to accept this node");
> > > + return false;
> > > + }
> > > +
> >
> > Is there any case nr_nodes = 0? If not, we don't need this check
>
> Note that nr_nodes doesn't include the joining node. The first
> joining sheep must pass the check.
>
Hmm, I think you'd better put this in the source for why-we-need-check-nr_nodes
It is not obvious for a glance.
Thanks
Yuan
More information about the sheepdog
mailing list