1<?xml version="1.0" encoding="UTF-8" standalone="no"?> 2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 3<html xmlns="http://www.w3.org/1999/xhtml"> 4 <head> 5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 6 <title>DbEnv::set_tx_max()</title> 7 <link rel="stylesheet" href="apiReference.css" type="text/css" /> 8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> 9 <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" /> 10 <link rel="up" href="txn.html" title="Chapter 13. The DbTxn Handle" /> 11 <link rel="prev" href="envget_tx_timestamp.html" title="DbEnv::get_tx_timestamp()" /> 12 <link rel="next" href="envset_tx_timestamp.html" title="DbEnv::set_tx_timestamp()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DbEnv::set_tx_max()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="envget_tx_timestamp.html">Prev</a> </td> 22 <th width="60%" align="center">Chapter 13. 23 The DbTxn Handle 24 </th> 25 <td width="20%" align="right"> <a accesskey="n" href="envset_tx_timestamp.html">Next</a></td> 26 </tr> 27 </table> 28 <hr /> 29 </div> 30 <div class="sect1" lang="en" xml:lang="en"> 31 <div class="titlepage"> 32 <div> 33 <div> 34 <h2 class="title" style="clear: both"><a id="envset_tx_max"></a>DbEnv::set_tx_max()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41DbEnv::set_tx_max(u_int32_t max); </pre> 42 <p> 43 Configure the Berkeley DB database environment to support at least 44 <span class="bold"><strong>max</strong></span> active transactions. This value 45 bounds the size of the memory allocated for transactions. Child 46 transactions are counted as active until they either commit or abort. 47 </p> 48 <p> 49 Transactions that update multiversion databases are not freed until 50 the last page version that the transaction created is flushed from 51 cache. This means that applications using multi-version concurrency 52 control may need a transaction for each page in cache, in the extreme 53 case. 54 </p> 55 <p> 56 When all of the memory available in the database environment for 57 transactions is in use, calls to 58 <a class="xref" href="txnbegin.html" title="DbEnv::txn_begin()">DbEnv::txn_begin()</a> will fail 59 (until some active transactions complete). If 60 <code class="classname">DbEnv::set_tx_max()</code> is never called, 61 the database environment is configured to support at least 100 62 active transactions. 63 </p> 64 <p> 65 The database environment's number of active transactions may also be 66 configured using the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. The 67 syntax of the entry in that file is a single line with the string 68 "set_tx_max", one or more whitespace characters, and the number of 69 transactions. Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is 70 read when the database environment is opened, it will silently 71 overrule configuration done before that time. 72 </p> 73 <p> 74 The <code class="methodname">DbEnv::set_tx_max()</code> method configures a database environment, 75 not only operations performed using the specified 76 <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> handle. 77 </p> 78 <p> 79 The <code class="methodname">DbEnv::set_tx_max()</code> method may not be called after the 80 <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> method is called. 81 If the database environment already exists when 82 <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> is called, the 83 information specified to <code class="methodname">DbEnv::set_tx_max()</code> will be ignored. 84 </p> 85 <p> 86 The <code class="methodname">DbEnv::set_tx_max()</code> <span> 87 88 <span> 89 method either returns a non-zero error value or throws an 90 exception that encapsulates a non-zero error value on 91 failure, and returns 0 on success. 92 </span> 93 </span> 94 </p> 95 <div class="sect2" lang="en" xml:lang="en"> 96 <div class="titlepage"> 97 <div> 98 <div> 99 <h3 class="title"><a id="id1712981"></a>Parameters</h3> 100 </div> 101 </div> 102 </div> 103 <div class="sect3" lang="en" xml:lang="en"> 104 <div class="titlepage"> 105 <div> 106 <div> 107 <h4 class="title"><a id="id1712803"></a>max</h4> 108 </div> 109 </div> 110 </div> 111 <p> 112 The <span class="bold"><strong>max</strong></span> parameter configures the 113 minimum number of simultaneously active transactions supported by 114 Berkeley DB database environment. 115 </p> 116 </div> 117 </div> 118 <div class="sect2" lang="en" xml:lang="en"> 119 <div class="titlepage"> 120 <div> 121 <div> 122 <h3 class="title"><a id="id1713173"></a>Errors</h3> 123 </div> 124 </div> 125 </div> 126 <p> 127 The <code class="methodname">DbEnv::set_tx_max()</code> <span> 128 129 <span> 130 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 131 exception, encapsulating one of the following non-zero errors, or return one 132 of the following non-zero errors: 133 </span> 134 </span> 135 </p> 136 <div class="sect3" lang="en" xml:lang="en"> 137 <div class="titlepage"> 138 <div> 139 <div> 140 <h4 class="title"><a id="id1712823"></a>EINVAL</h4> 141 </div> 142 </div> 143 </div> 144 <p> 145 If the method was called after <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> 146 was called; or if an invalid flag value or parameter was specified. 147 </p> 148 </div> 149 </div> 150 <div class="sect2" lang="en" xml:lang="en"> 151 <div class="titlepage"> 152 <div> 153 <div> 154 <h3 class="title"><a id="id1712911"></a>Class</h3> 155 </div> 156 </div> 157 </div> 158 <p> 159 <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a>, 160 <a class="link" href="txn.html" title="Chapter 13. The DbTxn Handle">DbTxn</a> 161 </p> 162 </div> 163 <div class="sect2" lang="en" xml:lang="en"> 164 <div class="titlepage"> 165 <div> 166 <div> 167 <h3 class="title"><a id="id1712824"></a>See Also</h3> 168 </div> 169 </div> 170 </div> 171 <p> 172 <a class="xref" href="txn.html#txnlist" title="Transaction Subsystem and Related Methods">Transaction Subsystem and Related Methods</a> 173 </p> 174 </div> 175 </div> 176 <div class="navfooter"> 177 <hr /> 178 <table width="100%" summary="Navigation footer"> 179 <tr> 180 <td width="40%" align="left"><a accesskey="p" href="envget_tx_timestamp.html">Prev</a> </td> 181 <td width="20%" align="center"> 182 <a accesskey="u" href="txn.html">Up</a> 183 </td> 184 <td width="40%" align="right"> <a accesskey="n" href="envset_tx_timestamp.html">Next</a></td> 185 </tr> 186 <tr> 187 <td width="40%" align="left" valign="top">DbEnv::get_tx_timestamp() </td> 188 <td width="20%" align="center"> 189 <a accesskey="h" href="index.html">Home</a> 190 </td> 191 <td width="40%" align="right" valign="top"> DbEnv::set_tx_timestamp()</td> 192 </tr> 193 </table> 194 </div> 195 </body> 196</html> 197