Joining of a coordinator
( Join process )
Data Structures:
-
isFirstNode : An integer variable that acts as a flag
to indicate whether the coordinator is the first one to come up.
-
cl : A client handle that is used to call RPC functions.
-
ipAddr : A character buffer to store the value of the ip-address
of the host machine.
-
hostName: A character buffer to store the name of the
host machine.
Join process is started whenever a node wants
to join the existing ARC system. It is started once for each machine. The
join process is responsible for initiating all the initializations and
bringing up the local co-ordinator process which is an RPC server, although
the initialization of the coordinator is done from within the coordinator
functions.
Following are the steps that comprise the join procedure and are
present in the file join.c:
-
Get the name and ip-address of the host machine.
-
From the command line argument given, find if the co-ordinator is the
first one to come or else it has to join an already existing ARC ring.
Accordingly set/reset the flag isFirstNode. If the user specifies
the string "first" as an argument while starting the join process then
it is assumed that it is the first cordinator. In the absence on any argument,
it is assumed that the coordinator wants to join the existing ring.
-
Start the ARC coordinator at the host machine. After starting the coordinator,
it needs some time to initialize itself before any of its RPC function
can be called from outside.
-
Create a client handle cl,on the local coordinator. If the handle
could not be created, it may be the case that the initialization of coordinator
has not yet taken place. Hence make 2 more attempts ( i second delay between
each consecutive call) to create client handle with the coordinator.
-
Call the RPC service boot_up(isFirstNode) on the local coordinator
using the client handle cl.