Janus Two-Phase Commit

From m204wiki
Revision as of 00:31, 15 January 2020 by ELowell (talk | contribs) (→‎Recovery)
Jump to navigation Jump to search

Janus Two-Phase Commit support allows transactions running in multiple Model 204 Onlines to participate in a single global transaction using the two-phase commit protocol. In addition, it enables Model 204 to participate in a global transaction with an Imagine database server. An Imagine Two-Phase Commit Coordinator is required to act as the two-phase commit coordinator. JANUS commands are used to define and start a two-phase commit port. Since there is no way to specify a 2PC port on two-phase commit related statements and functions, there is no point in specifying more than one 2PC port – if more than one is specified the first started 2PC port is always used.

Configuring Janus Two-Phase Commit

These are the configuaration steps:

  1. Using a JANUS DEFINE command, define a Janus 2PC that will be used to communicate with the coordinator. The following is a typical command for a two-phase commit port:

    JANUS DEFINE TWOPC * 2PC 10

  2. Specify the host address or name and port number for the coordinator. This is done with the JANUS ADDCOORDINATOR command as in:

    JANUS ADDCOORDINATOR TWOPC IMAGINE IMAGINEHOST.MYDOMAIN.COM 3456

    If, as in this example, the coordinator host is specified as a name, a name server must be specified using the JANUS NAMESERVER command.

Recovery

When running recovery (the RESTART command or the REGENERATE command) against journals that might contain global transactions, a JANUS 2PC port must be defined and a coordinator added to that port before the RESTART or REGENERATE command as in:

JANUS NAMESERVER 12.34.56.78 JANUS DEFINE TWOPC * 2PC 5 SSL 0 JANUS ADDCOORD TWOPC IMGCOORD IMGSERV.MYDOMAIN.COM 3333 JANUS ADDCA TWOPC PROCFILE TWOPC.CA JANUS START TWOPC RESTART ROLL BACK ERROR STOP ROLL FORWARD

If, as in this example, a certificate must be retrieved from a procedure file, it would be a really bad idea for that procedure file to be a file that needs to be recovered.

Classes and methods

The Transaction class contains methods:

NewGlobalto start a global transaction
SetGlobalto add a branch to a global transaction