1<!--$Id: txn_commit.so,v 11.20 2004/12/02 18:21:08 bostic Exp $--> 2<!--$Id: m4.tcl,v 11.28 2004/12/16 19:13:05 bostic Exp $--> 3<!--Copyright (c) 1997,2008 Oracle. All rights reserved.--> 4<!--See the file LICENSE for redistribution information.--> 5<html> 6<head> 7<title>Berkeley DB: txn commit</title> 8<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> 9<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> 10</head> 11<body bgcolor=white> 12<table width="100%"><tr valign=top> 13<td> 14<b><i>txn</i> <b>commit</b></b> 15</td> 16<td align=right> 17<a href="../api_tcl/api_tcl.html"><img src="../images/api.gif" alt="API"></a> 18<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td> 19</tr></table> 20<hr size=1 noshade> 21<tt> 22<b><pre>txn commit 23 [-nosync] 24 [-sync] 25</pre></b> 26<b>Description(txn commit)</b> 27<p>The <i>txn</i> <b>commit</b> command ends the transaction.</p> 28<p>In the case of nested transactions, if the transaction is a parent 29transaction with unresolved (neither committed or aborted) child 30transactions, the child transactions are aborted and the commit of the 31parent will succeed.</p> 32<p>In the case of nested transactions, if the transaction is a child 33transaction, its locks are not released, but are acquired by its parent. 34Although the commit of the child transaction will succeed, the actual 35resolution of the child transaction is postponed until the parent 36transaction is committed or aborted; that is, if its parent transaction 37commits, it will be committed, and if its parent transaction aborts, it 38will be aborted.</p> 39<p>If the <b>-nosync</b> option is not specified, a commit log record is 40written and flushed to disk, as are all previously written log records.</p> 41<p>The options are as follows:</p> 42<br> 43<b>-nosync</b><ul compact><li>Do not synchronously flush the log. This means the transaction will 44exhibit the ACI (atomicity, consistency, and isolation) properties, but 45not D (durability); that is, database integrity will be maintained, but 46it is possible that this transaction may be undone during recovery 47instead of being redone. 48<p>This behavior may be set for an entire Berkeley DB environment as part of 49the <b>berkdb env</b> call.</p></ul> 50<b>-sync</b><ul compact><li>Synchronously flush the log. This means the transaction will exhibit 51all of the ACID (atomicity, consistency, isolation and durability) 52properties. 53<p>This behavior is the default for Berkeley DB environments unless the 54<b>-nosync</b> option was specified to the <b>berkdb env</b> or 55<i>env</i> <b>txn</b> calls.</p></ul> 56<br> 57<p>After <i>txn</i> <b>commit</b> has been called, regardless of its return, the 58<b>txn</b> handle may not be accessed again. If <i>txn</i> <b>commit</b> 59encounters an error, this transaction and all child transactions of this 60transaction are aborted.</p> 61<p>The <i>txn</i> <b>commit</b> command returns 0 on success, and in the case of error, a Tcl error 62is thrown.</p> 63</tt> 64<table width="100%"><tr><td><br></td><td align=right> 65<a href="../api_tcl/api_tcl.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a> 66</td></tr></table> 67<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 68</body> 69</html> 70