Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples
Left Hand Pointer

Transaction Processing

1995 Version of ANSI (Equivalent to Current ISO Version) of Standard

Right Hand Pointer

6.3.1 Transaction processing

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:

  1. A process that is outside of a TRANSACTION cannot access the global variable modifications made within a TRANSACTION until that TRANSACTION has been COMMITted.
  2. A process that is inside a TRANSACTION is not explicitly excluded from accessing modifications made by other processes. However, a process cannot COMMIT a TRANSACTION that has accessed the global variable modifications of any other uncommitted TRANSACTION before that other TRANSACTION has been committed.
  3. If the transparameters within the argument to the TStart initiating the TRANSACTION specifies serializability, then all global modifications performed by the TRANSACTION and all other concurrently executing TRANSACTIONs must be equivalent to some serial, non-overlapping execution of those TRANSACTIONs.

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:

  1. The frame at the top of the PROCESS-STACK is examined. If the frame's linked list of CONTEXT-STRUCTUREs contains entries, they are processed in last-in-first-out order from their creation. If the CONTEXT-STRUCTURE is exclusive, all entries in the currently active local variable NAME-TABLE are pointed to empty DATA-CELLs. In all cases, the CONTEXT-STRUCTURE NAME-TABLEs are copied to the currently active NAME-TABLEs. For each REstart CONTEXT-STRUCTURE, $TLevel is decremented by one until $TLevel reaches 0 (zero) or the list is exhausted. If $TLevel does not reach 0 (zero), then:
    1. if the frame contains formallist information, it is processed as described by step d in the description of the Quit command (see 8.2.16).
    2. the frame is removed and step a repeats.
  2. $Test and the naked indicator are restored from the CONTEXT-STRUCTURE that triggered $TLevel to reach 0 (zero).
  3. A ROLLBACK is performed. If the TRANSACTION is not restartable, REstart terminates and an error condition occurs with ecode= "M27"
  4. $TRestart is incremented by 1. REstart terminates and execution continues with the initial TStart, which includes re-evaluating postcond, if any, and tstartargument, if any.
Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

Copyright © Standard Documents; 1977-2018 MUMPS Development Committee;
Copyright © Examples: 1995-2018 Ed de Moel;
Copyright © Annotations: 2003-2008 Jacquard Systems Research
Copyright © Annotations: 2008-2018 Ed de Moel.

This page most recently updated on 28-Nov-2011, 21:03:45 .

For comments, contact Ed de Moel (demoel@jacquardsystems.com)