Transaction Commands

Transactions are used in a manner similar to the other subsystems.  We create a handle to the transaction and  then use it for a variety of operations.  Some of the transaction commands use the environment instead.  Those are presented first.  The transaction command handle returned is the handle used by the various commands that can be transaction protected, such as cursors.

> <env> txn_checkpoint [-kbyte kb] [-min min]

This command causes a checkpoint of the transaction region.  It is a direct translation of the txn_checkpoint function.  It returns either a 0 (for success), a DB error message or it throws a Tcl error with a system message.  The arguments are:



> <env> txn_stat

This command returns transaction statistics.  It is a direct translation of the txn_stat function.  It will return a list of name/value pairs that correspond to the DB_TXN_STAT structure.



> <env> txn_id_set  current max

This is a diagnostic command that sets the next transaction id to be allocated and the maximum transaction
id, which is the point at which the relcaimation algorthm is triggered.



>  <txn> id

This command returns the transaction id.  It is a direct call to the txn_id function.  The typical use of this identifier is as the locker value for the lock_get and lock_vec calls.



> <txn> prepare

This command initiates a two-phase commit.  It is a direct call to the txn_prepare function.  It returns either a 0 (for success), a DB error message or it throws a Tcl error with a system message.


> <env> txn_timeout timeout

This command sets thetransaction timeout for transactions started in the future in this environment.  The timeout is in micorseconds.