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