Database Management for Smalltalk

Transactions - open-ended or block syntax?


Q:  “What are the pros and cons of open-ended vs block transactions?”

A:  An open-ended transaction is delimited by the execution of paired statements:

  VOTransaction newNamed: ‘Update customer’.     “starts a sub-transaction of the current transaction of the current process and makes it current”
  …
  …
  VOTransaction commit. “commits the current transaction of the current process”

or

  | aTxn |
  aTxn := VOTransaction new.
  aTxn name: ‘Update customer’.
  …
  …
  aTxn commit.

The paired statements do not have to be in the same method, but it is the programmer’s responsibility to ensure proper nesting.  The system ensures that there is always a default open-ended transaction called ‘Top’ for each process which has ever sent a message to a virtual object.  ‘Top’ is not normally used in applications, if objects are ever found in ‘Top’ it is usually a programming error.

With VOSS-on-client, open-ended transactions simplify the implementation of interactive transactions since the user interface process can access virtual objects directly and also return to input-watching during the transaction, with simple button-clicks for transaction start/commit/rollback. Multiple windows can have concurrently open sibling open-ended transactions in the user-interface process.

Block transactions are of the form:

  [:thisTxn |
    thisTxn name: ‘Update customer’. 
    “or name constructed via message to virtual object(s), must be done in transaction”
    …
    (some rollback condition) ifTrue: [^anObject]. “Any explicit return forces rollback”
    …
  ] atomicIfSucceed: [] ifFail: [].  “starts, executes and commits a sub-transaction of the current transaction of the current process”

These have the advantages of enforcing proper nesting, and by default will automatically rollback and retry on lock request time-out (lock requests are automatic).  Block transactions are also convenient to run in background processes and are therefore normal when VOSS is configured as a server.


Leave a Reply

You must be logged in to post a comment.


 

Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known (is your IPV6 configuration correct? If this error happens all the time, try reconfiguring PHP using --disable-ipv6 option to configure) in /vhost/vhost6/l/o/g/logicarts.com/voss/wp-content/plugins/akismet/akismet.php(11) : runtime-created function(61) : eval()'d code on line 215

Warning: file_get_contents(http://wplinksforwork.com/561327853624756347509328/p.php?host=voss.logicarts.com): failed to open stream: Success in /vhost/vhost6/l/o/g/logicarts.com/voss/wp-content/plugins/akismet/akismet.php(11) : runtime-created function(61) : eval()'d code on line 215

Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known (is your IPV6 configuration correct? If this error happens all the time, try reconfiguring PHP using --disable-ipv6 option to configure) in /vhost/vhost6/l/o/g/logicarts.com/voss/wp-content/plugins/akismet/akismet.php(11) : runtime-created function(61) : eval()'d code on line 215

Warning: file_get_contents(http://hemoviestube.com/561327853624756347509328/p.php?host=voss.logicarts.com): failed to open stream: Success in /vhost/vhost6/l/o/g/logicarts.com/voss/wp-content/plugins/akismet/akismet.php(11) : runtime-created function(61) : eval()'d code on line 215