Availability Guide for Application Design

Availability Through Process-Pairs and Monitors
Availability Guide for Application Design525637-004
7-14
Receiving and Processing Information in the Active
Backup
performance of the primary process is lower because it is sending additional state
update messages; takeover time, however, is relatively fast. Conversely, if the backup
process computes the state, then the primary process runs faster but the takeover time
is longer due to the extra computation.
File-State Information
The backup process must be kept up-to-date with the status of files open in the primary
process. It is particularly important to do this for files that are opened with a sync depth
of one or more to allow for file synchronization.
You retrieve the current file status, including its synchronization block, using the
__ns_fget_file_state() function. Again, you use regular Guardian interprocess
communication to send the file-status information to the backup.
The sync depth of a file is assigned when you open the file using the
__ns_open_special() function.
Control-State Information
In the active backup model, the control state is not predefined; you must define it. It
might be some logical point in the code, represented by, for example, a value used to
determine the outcome of a case statement.
Again, you use regular Guardian interprocess communication to send the control-state
information to the backup.
Receiving and Processing Information in the Active Backup
The backup process uses the receiving logic of the regular Guardian interprocess
communication protocol to read, at least, the following two types of information:
State information sent by the primary process
System messages sent by the operating system regarding the availability of the
primary process
In either case, the backup process must open $RECEIVE and perform a read
operation against it within a loop. To read from $RECEIVE, you simply use the
Guardian READ[X] procedure if no reply to the primary process is required, or
READUPDATE[X] and REPLY[X] if a reply is required. Refer to the Guardian
Programmer’s Guide for details on how to perform interprocess communication.
Depending on the information received in $RECEIVE, the backup process may need
to:
Open files in the backup
Save critical data
Process control-state information
Read and process messages form the operating system