[Openais] sync v2 rfc

Steven Dake sdake at redhat.com
Fri Jun 26 01:03:14 PDT 2009


This patch only works when compatibility: none is specified in the
corosync configuration file.

It allows synchronization to complete between a corosync process without
ais services and a corosync process with ais services (with evt disabled
by hacking the openaisserviceenable.c file).

request for comments welcome

The algorithm that it implements is also attached.

Regards
-steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: syncv2-rfc.patch
Type: text/x-patch
Size: 19689 bytes
Desc: not available
Url : http://lists.linux-foundation.org/pipermail/openais/attachments/20090626/d944be8a/attachment.bin 
-------------- next part --------------
Differences from v1 algorithm:
The state machine now builds a list of services that are contained on every
node.  

requirements of algorithm:
dependencies must always have a lower service id then dependendent services
ie:
	2 depends on 1 (allowed)
	1 depends on 2 (not allowed)

data structure per node:

enum sync_process_state {
	NOTPROCESSED,
	INIT,
	PROCESS,
	ABORT,
	ACTIVATE
}
	
enum sync_v2_state {
	SYNC_SERVICELIST_BUILD
	SYNC_PROCESS
	SYNC_BARRIER
}

struct my_service_entry {
	int service_id;
	struct process_callbacks;
	int state;
};
struct my_processor_entry {
	int nodeid;
	int received;
};

struct my_processor_list[128];

int my_processor_list_entries = 0;

struct my_service_entry my_service_list[128];

int my_service_list_entries = 0;

On event 
--------
configuration change
--------------------
if state == SYNC_PROCESS and configuration change == regular
	destroy work handler
	execute my_service_list[my_service_idx].sync_abort
if configuration change is regular 
	enter SYNC_V2_SERVICELIST_BUILD(processor list)

receipt of service_build message
----------------------------------
if service_build.ring_id == my_ring_id
	merge service_build entries into my_service_list
		if there are new entries, set the callbacks to dummy handlers
	set received to 1 for nodeid in my_processor_list
	if for all processors in my processor list received is 1
		enter SYNC_PROCESS

receipt of barrier message
--------------------------
	set my_processor_list received for message's nodeid to 1
	if for all processors in my_processor_list received is 1
		increment process_idx
		if my_service_list_entries == my_processing_idx
			call callback to indicate sync done
		else
			enter SYNC_PROCESS

execution of work handler callback:
-----------------------------------
if my_service_list[my_processing_idx].state == NOTPROCESSED
	set sync_process.state = INIT
	call my_service_list[processing_idx].sync_init

if my_service_list[my_processing_idx].state == INIT
	set sync_process.state = PROCESS

if my_service_list[my_processing_idx].state == PROCESS
	call my_service_list[processing_idx].sync_process
	if process returns 0 (indicates completed)
		set my_service_list[processing_idx].ss.state = ACTIVATE

if my_service_list[my_processing_idx].state == ACTIVATE
	call my_service_list[processing_idx].sync_activate
	enter SYNC_BARRIER
	return -1 (indicating totempg callback should stop)

return 0 (indicating totempg processing of callback should continue)

pseudocode for enter operations:
enter SYNC_SERVICELIST_BUILD (arguments are member list node ids)
	set state to SYNC_V2_SERVICELIST_BUILD
	reset my_processor_list with argument setting received flag to 0
	create my_service_list
	set my_processing_idx = 0
	create service_build message from my_service_list
	transmit service_build message

enter SYNC_PROCESS (no arguments)
	set state to SYNC_PROCESS
	set received flag for all processors in my_processor_list to 0
	create process work handler

enter SYNC_BARRIER (no arguments)
	set state to SYNC_BARRIER
	transmit barrier message for this ring id


More information about the Openais mailing list