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>DB_ENV->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 12. The DB_TXN Handle" /> 11 <link rel="prev" href="envget_tx_timestamp.html" title="DB_ENV->get_tx_timestamp()" /> 12 <link rel="next" href="envset_tx_timestamp.html" title="DB_ENV->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">DB_ENV->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 12. 23 The DB_TXN 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>DB_ENV->set_tx_max()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db.h> 39 40int 41DB_ENV->set_tx_max(DB_ENV *dbenv, 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="DB_ENV->txn_begin()">DB_ENV->txn_begin()</a> will fail 59 (until some active transactions complete). If 60 <code class="classname">DB_ENV->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">DB_ENV->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 DB_ENV Handle">DB_ENV</a> handle. 77 </p> 78 <p> 79 The <code class="methodname">DB_ENV->set_tx_max()</code> method may not be called after the 80 <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> method is called. 81 If the database environment already exists when 82 <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> is called, the 83 information specified to <code class="methodname">DB_ENV->set_tx_max()</code> will be ignored. 84 </p> 85 <p> 86 The <code class="methodname">DB_ENV->set_tx_max()</code> <span> 87 <span> 88 method returns a non-zero error value on failure and 0 on success. 89 </span> 90 91 </span> 92 </p> 93 <div class="sect2" lang="en" xml:lang="en"> 94 <div class="titlepage"> 95 <div> 96 <div> 97 <h3 class="title"><a id="id1707824"></a>Parameters</h3> 98 </div> 99 </div> 100 </div> 101 <div class="sect3" lang="en" xml:lang="en"> 102 <div class="titlepage"> 103 <div> 104 <div> 105 <h4 class="title"><a id="id1707930"></a>max</h4> 106 </div> 107 </div> 108 </div> 109 <p> 110 The <span class="bold"><strong>max</strong></span> parameter configures the 111 minimum number of simultaneously active transactions supported by 112 Berkeley DB database environment. 113 </p> 114 </div> 115 </div> 116 <div class="sect2" lang="en" xml:lang="en"> 117 <div class="titlepage"> 118 <div> 119 <div> 120 <h3 class="title"><a id="id1708075"></a>Errors</h3> 121 </div> 122 </div> 123 </div> 124 <p> 125 The <code class="methodname">DB_ENV->set_tx_max()</code> <span> 126 <span> 127 method may fail and return one of the following non-zero errors: 128 </span> 129 130 </span> 131 </p> 132 <div class="sect3" lang="en" xml:lang="en"> 133 <div class="titlepage"> 134 <div> 135 <div> 136 <h4 class="title"><a id="id1707461"></a>EINVAL</h4> 137 </div> 138 </div> 139 </div> 140 <p> 141 If the method was called after <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> 142 was called; or if an invalid flag value or parameter was specified. 143 </p> 144 </div> 145 </div> 146 <div class="sect2" lang="en" xml:lang="en"> 147 <div class="titlepage"> 148 <div> 149 <div> 150 <h3 class="title"><a id="id1708007"></a>Class</h3> 151 </div> 152 </div> 153 </div> 154 <p> 155 <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a>, 156 <a class="link" href="txn.html" title="Chapter 12. The DB_TXN Handle">DB_TXN</a> 157 </p> 158 </div> 159 <div class="sect2" lang="en" xml:lang="en"> 160 <div class="titlepage"> 161 <div> 162 <div> 163 <h3 class="title"><a id="id1708004"></a>See Also</h3> 164 </div> 165 </div> 166 </div> 167 <p> 168 <a class="xref" href="txn.html#txnlist" title="Transaction Subsystem and Related Methods">Transaction Subsystem and Related Methods</a> 169 </p> 170 </div> 171 </div> 172 <div class="navfooter"> 173 <hr /> 174 <table width="100%" summary="Navigation footer"> 175 <tr> 176 <td width="40%" align="left"><a accesskey="p" href="envget_tx_timestamp.html">Prev</a> </td> 177 <td width="20%" align="center"> 178 <a accesskey="u" href="txn.html">Up</a> 179 </td> 180 <td width="40%" align="right"> <a accesskey="n" href="envset_tx_timestamp.html">Next</a></td> 181 </tr> 182 <tr> 183 <td width="40%" align="left" valign="top">DB_ENV->get_tx_timestamp() </td> 184 <td width="20%" align="center"> 185 <a accesskey="h" href="index.html">Home</a> 186 </td> 187 <td width="40%" align="right" valign="top"> DB_ENV->set_tx_timestamp()</td> 188 </tr> 189 </table> 190 </div> 191 </body> 192</html> 193