☜ | Transaction Processing1995 Version of ANSI (Equivalent to Current ISO Version) of Standard | ☞ |
A TRANSACTION is the execution of a sequence of commands that begins with a TStart and ends with either a TCommit or a TROllback, and that is not within the scope of any other TRANSACTION. A TRANSACTION may be restartable, serializable, or both, depending on parameters specified in the TStart that initiates the TRANSACTION. (See 8.2.22 TStart.) These properties affect execution of the TRANSACTION as described below.
TStart adds one to the intrinsic special variable $TLevel, which is initialized to zero when a process begins execution. TCommit subtracts one from $TLevel if $TLevel is greater than zero. TROllback sets $TLevel to zero. A process is within a TRANSACTION whenever its $TLevel value is greater than zero. A process is not within a TRANSACTION whenever its $TLevel value is zero.
If, as a result of a TCommit, $TLevel would become zero, an attempt is made to COMMIT the TRANSACTION. A COMMIT causes the global variable modifications made within the TRANSACTION to become durable and accessible to other processes.
A ROLLBACK is performed if, within a TRANSACTION, either a TROllback or a Halt command is executed. A ROLLBACK rescinds all global variable modifications performed within the scope of the TRANSACTION, removes any nrefs from the Lock-LIST that were not included in the Lock-LIST when the TRANSACTION started (i.e. when $TLevel changed from zero to one), and removes any REstart CONTEXT-STRUCTUREs for both the TRANSACTION linked list and the PROCESS-STACK linked list, discarding the CONTEXT-STRUCTUREs. M errors do not cause an implicit ROLLBACK. (See the Lock command for definitions of nref and Lock-LIST.)
Global variable modifications carried out by commands executed within a TRANSACTION are subject to the following rules:
If it has been determined that a TRANSACTION in progress either cannot or is unlikely to conform to the above-stated rules, then the TRANSACTION implicitly REstarts. In addition, the TREstart command explicitly causes the TRANSACTION to REstart.
The actions of a REstart depend on whether it is restartable. A TRANSACTION is restartable if the initiating TStart specifies a restartargument. (See 8.2.22 TStart.) A REstart of a restartable TRANSACTION causes execution to resume with the initial TStart. A REstart of a non-restartable TRANSACTION ends in an error (ecode="M27").
The following discussion uses terms defined in the Variable Handling (see 7.1.2.2) and Process-Stack (see 7.1.2.3) models and, like those subclauses, does not imply a required implementation technique.
Execution of a REstart occurs as follows:
Copyright © Standard Documents; 1977-2024 MUMPS Development Committee;
Copyright © Examples: 1995-2024 Ed de Moel;
Copyright © Annotations: 2003-2008 Jacquard Systems Research
Copyright © Annotations: 2008-2024 Ed de Moel.
This page most recently updated on 17-Nov-2023, 10:35:45.
For comments, contact Ed de Moel (demoel@jacquardsystems.com)