[Openais] corosync trunk determine memb list when running in compatibility mode

Jim Meyering jim at meyering.net
Mon Jun 29 10:17:19 PDT 2009


Steven Dake wrote:
> When cross communicating with whitetank, we need to determine a list of
> members for the syncv2 protocol to operate upon.  The reason is that the
> syncv2 capable machines (ie: corosync in whitetank compat mode) may be
> only a subset of the cluster when run with other openais whitetank
> cluster members.
>
> This patch sends determines the membership of the syncv2 members.  It
> relies on the barrier functionality in the regular sync operation to
> ensure that all syncv2 determination messages are received before
> starting its operation.

Hi Steve,

Minor suggestions,

> Index: exec/syncv2.c
> ===================================================================
...
> +static void sync_memb_determine (unsigned int nodeid, const void *msg)
> +{
> +	const struct req_exec_memb_determine_message *req_exec_memb_determine_message = msg;
> +	int found = 0;
> +	int i;
> +
> +	if (memcmp (&req_exec_memb_determine_message->ring_id,
> +		&my_memb_determine_ring_id, sizeof (struct memb_ring_id)) != 0) {
> +
> +		return;
> +	}
> +
> +	my_memb_determine = 1;
> +	for (i = 0; i < my_memb_determine_list_entries; i++) {
> +		if (my_memb_determine_list[i] == nodeid) {
> +			found = 1;

Slightly more efficient to add "break;" here.

> +		}
> +	}
> +	if (found == 0) {
> +		my_memb_determine_list[my_memb_determine_list_entries] = nodeid;
> +		my_memb_determine_list_entries += 1;

IMHO, it's better (on readability/maintainability fronts) to write
the above two lines like this:

              my_memb_determine_list[my_memb_determine_list_entries++] = nodeid;

Then, you don't have to worry about whether that long index name
is really the same variable that's being incremented on the next line.

> +	}
> +}
...


More information about the Openais mailing list