TMF Application Programmer's Guide (G06.26+)
Designing Multithreaded Processes
HP NonStop TMF Application Programmer’s Guide—522419-005
3-9
Checkpointing Strategy
When a primary-to-backup switch occurs, the backup process must determine which
transactions were committed and which were aborted. The backup requester does this
by issuing a RESUMETRANSACTION call, followed by ENDTRANSACTION or
ABORTTRANSACTION for each tag value in the tag list.
If a transaction may have committed before the failure occurred, the
RESUMETRANSACTION call returns error number 76 (transaction ended) in the
status variable. In that case, the backup process (now acting as a primary) should call
ENDTRANSACTION. If ENDTRANSACTION returns no errors, the transaction is
committed and the application starts a new backup process and then issues a READ to
the terminal to accept the next operator request. If ENDTRANSACTION returns an
error, the transaction is aborted. The application should start a new backup process
and then restart the transaction using checkpointed application data.
If a transaction was aborted the RESUMETRANSACTION call returns one of the error
numbers 90 through 97 described in Table 2-2 on page 2-5 of this manual. In this
case, the backup process (now acting as a primary) should call
ABORTTRANSACTION, start a new backup process, and then restart the transaction
using the checkpointed application data.
If RESUMETRANSACTION returns no error, TMF has not yet sufficiently processed
the failure of the primary process to indicate the aborted transaction. The application
should call ABORTTRANSACTION, start a new backup, and restart the transaction
using checkpointed application data.
The MAINLOOP Code
Initially, for each user terminal, the MAINLOOP code opens the terminal, displays the
application data form on the terminal’s screen, and issues a nowait READ call to detect
when the operator presses a function key.
Thereafter, the MAINLOOP code continually checks for AWAITIO completions.
Upon detecting a successful AWAITIO completion, the MAINLOOP code determines
what type of nowait call has completed:
•
If the filenumber returned by the AWAITIO completion is that of a terminal, the
MAINLOOP code passes control to the BEGINTRANSACTION code.
•
If the filenumber returned by the AWAITIO completion is that of the TFILE, the
completion is for a nowait ENDTRANSACTION call. In that case, control passes to
the CHECKPOINTTFILEENTRY code.
•
If the filenumber returned by the AWAITIO completion is that of a server process,
the completion is for a nowait WRITEREAD call. In that case, the MAINLOOP code
must determine whether or not this was the final WRITEREAD call to be issued for
the transaction.
If the completed WRITEREAD call is the final one for the transaction, control
passes to the ENDTRANSACTION code.