1<!--$Id: env_set_lk_max_locks.so,v 10.23 2004/09/28 15:04:20 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_lk_max_locks</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_lk_max_locks</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_lk_max_locks(u_int32_t max);
26<p>
27int
28DbEnv::get_lk_max_locks(u_int32_t *lk_maxp);
29</pre></b>
30<hr size=1 noshade>
31<b>Description: DbEnv::set_lk_max_locks</b>
32<p>Set the maximum number of locks supported by the Berkeley DB environment.
33This value is used by <a href="../api_cxx/env_open.html">DbEnv::open</a> to estimate how much space to
34allocate for various lock-table data structures.  The default value is
351000 locks. For specific information on configuring the size of the lock
36subsystem, see <a href="../ref/lock/max.html">Configuring locking:
37sizing the system</a>.</p>
38<p>The database environment's maximum number of locks may also be configured using the
39environment's <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file.  The syntax of the entry in that
40file is a single line with the string "set_lk_max_locks", one or more whitespace
41characters, and the number of locks.
42Because the <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment
43is opened, it will silently overrule configuration done before that
44time.</p>
45<p>The DbEnv::set_lk_max_locks method configures a database environment, not only operations
46performed using the specified <a href="../api_cxx/env_class.html">DbEnv</a> handle.</p>
47<p>The DbEnv::set_lk_max_locks method may not be called after the <a href="../api_cxx/env_open.html">DbEnv::open</a> method is
48called.
49If the database environment already exists when
50<a href="../api_cxx/env_open.html">DbEnv::open</a> is called, the information specified to DbEnv::set_lk_max_locks
51will be ignored.
52</p>
53<p>The DbEnv::set_lk_max_locks method
54either returns a non-zero error value
55or throws an exception that encapsulates a non-zero error value on
56failure, and returns 0 on success.
57</p>
58<b>Parameters</b> <br>
59 <b>max</b><ul compact><li>The <b>max</b> parameter is the maximum number of locks supported by
60the Berkeley DB environment.</ul>
61<br>
62<br><b>Errors</b>
63<p>The DbEnv::set_lk_max_locks method
64may fail and throw
65<a href="../api_cxx/except_class.html">DbException</a>,
66encapsulating one of the following non-zero errors, or return one of
67the following non-zero errors:</p>
68<br>
69<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
70invalid flag value or parameter was specified.</ul>
71<br>
72<hr size=1 noshade>
73<b>Description: DbEnv::get_lk_max_locks</b>
74<p>The DbEnv::get_lk_max_locks method returns the maximum number of locks.</p>
75<p>The DbEnv::get_lk_max_locks method may be called at any time during the life of the
76application.</p>
77<p>The DbEnv::get_lk_max_locks method
78either returns a non-zero error value
79or throws an exception that encapsulates a non-zero error value on
80failure, and returns 0 on success.
81</p>
82<b>Parameters</b> <br>
83 <b>lk_maxp</b><ul compact><li>The DbEnv::get_lk_max_locks method returns  the
84maximum number of locks in <b>lk_maxp</b>.</ul>
85<br>
86<hr size=1 noshade>
87<br><b>Class</b>
88<a href="../api_cxx/env_class.html">DbEnv</a>, <a href="../api_cxx/lock_class.html">DbLock</a>
89<br><b>See Also</b>
90<a href="../api_cxx/lock_list.html">Locking Subsystem and Related Methods</a>
91</tt>
92<table width="100%"><tr><td><br></td><td align=right>
93<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>
94</td></tr></table>
95<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
96</body>
97</html>
98