1
<!--$Id: txn_commit.so,v 11.16 2001/04/18 13:44:53 bostic Exp $-->
2
<!--$Id: m4.tcl,v 11.22 2001/04/18 15:50:10 bostic Exp $-->
3
<!--Copyright 1997-2001 by Sleepycat Software, Inc.-->
4
<!--All rights reserved.-->
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,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
12
<a name="2"><!--meow--></a>
13
<table width="100%"><tr valign=top>
15
<h1><i>txn</i> <b>commit</b></h1>
18
<a href="../api_tcl/tcl_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
27
<p>The <i>txn</i> <b>commit</b> command ends the transaction.
28
<p>In the case of nested transactions, if the transaction is a parent
29
transaction with unresolved (neither committed or aborted) child
30
transactions, the child transactions are aborted and the commit of the
32
<p>In the case of nested transactions, if the transaction is a child
33
transaction, its locks are not released, but are acquired by its parent.
34
Although the commit of the child transaction will succeed, the actual
35
resolution of the child transaction is postponed until the parent
36
transaction is committed or aborted; that is, if its parent transaction
37
commits, it will be committed, and if its parent transaction aborts, it
39
<p>If the <b>-nosync</b> option is not specified, a commit log record is
40
written and flushed to disk, as are all previously written log records.
41
<p>The options are as follows:
43
<p><dt>-nosync<dd>Do not synchronously flush the log. This means the transaction will
44
exhibit the ACI (atomicity, consistency, and isolation) properties, but
45
not D (durability); that is, database integrity will be maintained, but
46
it is possible that this transaction may be undone during recovery
47
instead of being redone.
48
<p>This behavior may be set for an entire Berkeley DB environment as part of
49
the <b>berkdb env</b> interface.
50
<p><dt>-sync<dd>Synchronously flush the log. This means the transaction will exhibit
51
all of the ACID (atomicity, consistency, isolation and durability)
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> interfaces.
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>
59
encounters an error, this transaction and all child transactions of this
60
transaction are aborted.
61
<p>The <i>txn</i> <b>commit</b> command returns 0 on success, and in the case of error, a Tcl error
64
<table width="100%"><tr><td><br></td><td align=right>
65
<a href="../api_tcl/tcl_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
67
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>