[Spread-users] Newbie question: view changes!!

Jonathan Stanton jonathan at cnds.jhu.edu
Fri Jun 11 17:49:46 EDT 2004


I'm not sure I completely understand what you are trying to do, but I can 
answer some of your questions. Since you are trying to do database 
synchronization of some sort, I would recommend you look at the database 
replication papers on our website:


On Fri, Jun 04, 2004 at 10:44:46AM +0200, Gus wrote: 
> Hello everybody.
>I´m a new spread user, and i have this question: how do i manage view
>changes? I will use an example:
> imagine i have 5 databases (A,B,C,D,E), and after connecting to the
>spread mailbox the view is like this: B,E,C,A,D, ok?

The membership view that spread delivers will always be in the same order 
at every client who is a member of the group and the order of members will 
be deterministic. What the order is may change in the future (although 
never within a specific spread version) but it will always be 

> So, first question:

> - How do i get the list of the members of the view? I mean, how do i get
>the list with the B,E,C,A,D?

It is delivered to you in a Spread Message you receive with SP_recv() (in 
the C library, other language interfaces have different function names). 
The message will be of type REG_MEMB_MESS  which can be tested by the 
function "Is_reg_memb_mess()". That message will have the current group 
membership list stored in the "groups" array and the virtual synchrony set 
in the body of the message. 

> And now the second part. Only one of the databases is able to do the
>updates, the first one of the list. In this case it would be "B", so if
>"E" wanted to do an update, it would get the list of members, check 
>who´sthe first one and send it to "B", right? So is there any way i can use
>spread to select who´s the primary database? For example, if one of the
>databases crashes there would be a view change and that database would
>disappear from the list, and if it were the primary one who crashed
>another one should be chosen as the primary.

Since the list of members is determinstic, you can just pick the first one 
in the list and everyone will choose the same database. However, there are 
some tricky cases that can occur when multiple failures occur in close 
proximity, or transactions are in-flight when failures or changes occur. 
So I recommend you take a look at the papers I referenced at the top of 
this message as they explain all of the details. Exactly what is required 
depends on the exact semantics of your database and what type of failures 
you are dealing with. 

> Thank you so much!

I hope this helped you,


Jonathan R. Stanton         jonathan at cs.jhu.edu
Dept. of Computer Science   
Johns Hopkins University    

More information about the Spread-users mailing list