1<!--$Id: env_set_tx_max.so,v 10.47 2006/06/19 22:25:31 bostic Exp $-->
2<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
3<!--See the file LICENSE for redistribution information.-->
4<html>
5<head>
6<title>Berkeley DB: DbEnv::set_tx_max</title>
7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
9</head>
10<body bgcolor=white>
11<table width="100%"><tr valign=top>
12<td>
13<b>DbEnv::set_tx_max</b>
14</td>
15<td align=right>
16<a href="/api_cxx/api_core.html"><img src="/images/api.gif" alt="API"></a>
17<a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a></td>
18</tr></table>
19<hr size=1 noshade>
20<tt>
21<b><pre>
22#include &lt;db_cxx.h&gt;
23<p>
24int
25DbEnv::set_tx_max(u_int32_t max);
26<p>
27int
28DbEnv::get_tx_max(u_int32_t *tx_maxp);
29</pre></b>
30<hr size=1 noshade>
31<b>Description: DbEnv::set_tx_max</b>
32<p>Configure the Berkeley DB database environment to support at least <b>max</b>
33active transactions.  This value bounds the size of the memory allocated
34for transactions.  Child transactions are counted as active until they
35either commit or abort.</p>
36<p>Transactions that update multiversion databases are not freed until the
37last page version that the transaction created is flushed from cache.
38This means that applications using multi-version concurrency control may
39need a transaction for each page in cache, in the extreme case.</p>
40<p>When all of the memory available in the database environment for
41transactions is in use, calls to <a href="/api_cxx/txn_begin.html">DbEnv::txn_begin</a> will fail (until some
42active transactions complete).  If this interface is never called, the
43database environment is configured to support at least 100 active
44transactions.</p>
45<p>The database environment's number of active transactions may also be configured using the
46environment's <a href="/ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file.  The syntax of the entry in that
47file is a single line with the string "set_tx_max", one or more whitespace
48characters, and the number of transactions.
49Because the <a href="/ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment
50is opened, it will silently overrule configuration done before that
51time.</p>
52<p>The DbEnv::set_tx_max method configures a database environment, not only operations
53performed using the specified <a href="/api_cxx/env_class.html">DbEnv</a> handle.</p>
54<p>The DbEnv::set_tx_max method may not be called after the <a href="/api_cxx/env_open.html">DbEnv::open</a> method is
55called.
56If the database environment already exists when
57<a href="/api_cxx/env_open.html">DbEnv::open</a> is called, the information specified to DbEnv::set_tx_max
58will be ignored.
59</p>
60<p>The DbEnv::set_tx_max method
61either returns a non-zero error value
62or throws an exception that encapsulates a non-zero error value on
63failure, and returns 0 on success.
64</p>
65<b>Parameters</b> <br>
66 <b>max</b><ul compact><li>The <b>max</b> parameter configures the minimum number of
67simultaneously active transactions supported by Berkeley DB database
68environment.</ul>
69<br>
70<br><b>Errors</b>
71<p>The DbEnv::set_tx_max method
72may fail and throw
73<a href="/api_cxx/except_class.html">DbException</a>,
74encapsulating one of the following non-zero errors, or return one of
75the following non-zero errors:</p>
76<br>
77<b>EINVAL</b><ul compact><li>If the method was called after <a href="/api_cxx/env_open.html">DbEnv::open</a> was called; or if an
78invalid flag value or parameter was specified.</ul>
79<br>
80<hr size=1 noshade>
81<b>Description: DbEnv::get_tx_max</b>
82<p>The DbEnv::get_tx_max method returns the number of active transactions.</p>
83<p>The DbEnv::get_tx_max method may be called at any time during the life of the
84application.</p>
85<p>The DbEnv::get_tx_max method
86either returns a non-zero error value
87or throws an exception that encapsulates a non-zero error value on
88failure, and returns 0 on success.
89</p>
90<b>Parameters</b> <br>
91 <b>tx_maxp</b><ul compact><li>The DbEnv::get_tx_max method returns  the
92number of active transactions in <b>tx_maxp</b>.</ul>
93<br>
94<hr size=1 noshade>
95<br><b>Class</b>
96<a href="/api_cxx/env_class.html">DbEnv</a>, <a href="/api_cxx/txn_class.html">DbTxn</a>
97<br><b>See Also</b>
98<a href="/api_cxx/txn_list.html">Transaction Subsystem and Related Methods</a>
99</tt>
100<table width="100%"><tr><td><br></td><td align=right>
101<a href="/api_cxx/api_core.html"><img src="/images/api.gif" alt="API"></a><a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a>
102</td></tr></table>
103<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
104</body>
105</html>
106