Debian Codegraph @

docs/api_reference/CXX/envset_lk_detect.html

raw symbols SCIP
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_lk_detect()</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="lock.html" title="Chapter 7.  The DbLock Handle" />
11 <link rel="prev" href="envset_lk_conflicts.html" title="DbEnv::set_lk_conflicts()" />
12 <link rel="next" href="envset_lk_max_lockers.html" title="DbEnv::set_lk_max_lockers()" />
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_lk_detect()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="envset_lk_conflicts.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 7. 
26 The DbLock Handle
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="envset_lk_max_lockers.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_lk_detect"></a>DbEnv::set_lk_detect()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db_cxx.h&gt;
42
43 int
44 DbEnv::set_lk_detect(u_int32_t detect); </pre>
45 <p>
46 Set if the deadlock detector is to be run whenever a lock conflict
47 occurs, and specify what lock request(s) should be rejected. As
48 transactions acquire locks on behalf of a single locker ID, rejecting
49 a lock request associated with a transaction normally requires the
50 transaction be aborted.
51 </p>
52 <p>
53 The database environment's deadlock detector configuration may also be
54 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
55 syntax of the entry in that file is a single line with the string
56 "set_lk_detect", one or more whitespace characters, and the method
57 <span class="bold"><strong>detect</strong></span> parameter as a string; for
58 example, "set_lk_detect DB_LOCK_OLDEST". Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a>
59 file is read when the database environment is opened, it will
60 silently overrule configuration done before that time.
61 </p>
62 <p>
63 The <code class="methodname">DbEnv::set_lk_detect()</code> method configures a database environment,
64 not only operations performed using the specified <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>
65 handle.
66 </p>
67 <p>
68 The <code class="methodname">DbEnv::set_lk_detect()</code> method may be
69 called either before or after environment open, but once it is set
70 it may not be changed again during the environment's lifetime.
71 </p>
72 <p>
73 The <code class="methodname">DbEnv::set_lk_detect()</code> <span>
74
75 <span>
76 method either returns a non-zero error value or throws an
77 exception that encapsulates a non-zero error value on
78 failure, and returns 0 on success.
79 </span>
80 </span>
81 </p>
82 <div class="sect2" lang="en" xml:lang="en">
83 <div class="titlepage">
84 <div>
85 <div>
86 <h3 class="title"><a id="idp7920464"></a>Parameters</h3>
87 </div>
88 </div>
89 </div>
90 <div class="sect3" lang="en" xml:lang="en">
91 <div class="titlepage">
92 <div>
93 <div>
94 <h4 class="title"><a id="idp7920848"></a>detect</h4>
95 </div>
96 </div>
97 </div>
98 <p>
99 The <span class="bold"><strong>detect</strong></span> parameter configures the
100 deadlock detector. The deadlock detector will reject the lock request
101 with the lowest priority. If multiple lock requests have the lowest
102 priority, then the <span class="bold"><strong>detect</strong></span> parameter
103 is used to select which of those lock requests to reject. The
104 specified value must be one of the following list:
105 </p>
106 <div class="itemizedlist">
107 <ul type="disc">
108 <li>
109 <p><a id="set_lk_detect_DB_LOCK_DEFAULT"></a>
110 <code class="literal">DB_LOCK_DEFAULT</code>
111 </p>
112 <p>
113 Use whatever lock policy was specified when the database environment
114 was created. If no lock policy has yet been specified, set the lock
115 policy to DB_LOCK_RANDOM.
116 </p>
117 </li>
118 <li>
119 <p><a id="set_lk_detect_DB_LOCK_EXPIRE"></a>
120 <code class="literal">DB_LOCK_EXPIRE</code>
121 </p>
122 <p>
123 Reject lock requests which have timed out. No other deadlock
124 detection is performed.
125 </p>
126 </li>
127 <li>
128 <p><a id="set_lk_detect_DB_LOCK_MAXLOCKS"></a>
129 <code class="literal">DB_LOCK_MAXLOCKS</code>
130 </p>
131 <p>
132 Reject the lock request for the locker ID with the most locks.
133 </p>
134 </li>
135 <li>
136 <p><a id="set_lk_detect_DB_LOCK_MAXWRITE"></a>
137 <code class="literal">DB_LOCK_MAXWRITE</code>
138 </p>
139 <p>
140 Reject the lock request for the locker ID with the most write locks.
141 </p>
142 </li>
143 <li>
144 <p><a id="set_lk_detect_DB_LOCK_MINLOCKS"></a>
145 <code class="literal">DB_LOCK_MINLOCKS</code>
146 </p>
147 <p>
148 Reject the lock request for the locker ID with the fewest locks.
149 </p>
150 </li>
151 <li>
152 <p><a id="set_lk_detect_DB_LOCK_MINWRITE"></a>
153 <code class="literal">DB_LOCK_MINWRITE</code>
154 </p>
155 <p>
156 Reject the lock request for the locker ID with the fewest write locks.
157 </p>
158 </li>
159 <li>
160 <p><a id="set_lk_detect_DB_LOCK_OLDEST"></a>
161 <code class="literal">DB_LOCK_OLDEST</code>
162 </p>
163 <p>
164 Reject the lock request for the locker ID with the oldest lock.
165 </p>
166 </li>
167 <li>
168 <p><a id="set_lk_detect_DB_LOCK_RANDOM"></a>
169 <code class="literal">DB_LOCK_RANDOM</code>
170 </p>
171 <p>
172 Reject the lock request for a random locker ID.
173 </p>
174 </li>
175 <li>
176 <p><a id="set_lk_detect_DB_LOCK_YOUNGEST"></a>
177 <code class="literal">DB_LOCK_YOUNGEST</code>
178 </p>
179 <p>
180 Reject the lock request for the locker ID with the youngest lock.
181 </p>
182 </li>
183 </ul>
184 </div>
185 </div>
186 </div>
187 <div class="sect2" lang="en" xml:lang="en">
188 <div class="titlepage">
189 <div>
190 <div>
191 <h3 class="title"><a id="idp7938688"></a>Errors</h3>
192 </div>
193 </div>
194 </div>
195 <p>
196 The <code class="methodname">DbEnv::set_lk_detect()</code> <span>
197
198 <span>
199 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a>
200 exception, encapsulating one of the following non-zero errors, or return one
201 of the following non-zero errors:
202 </span>
203 </span>
204 </p>
205 <div class="sect3" lang="en" xml:lang="en">
206 <div class="titlepage">
207 <div>
208 <div>
209 <h4 class="title"><a id="idp7935664"></a>EINVAL</h4>
210 </div>
211 </div>
212 </div>
213 <p>
214 An invalid flag value or parameter was specified.
215 </p>
216 </div>
217 </div>
218 <div class="sect2" lang="en" xml:lang="en">
219 <div class="titlepage">
220 <div>
221 <div>
222 <h3 class="title"><a id="idp7930088"></a>Class</h3>
223 </div>
224 </div>
225 </div>
226 <p>
227 <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>,
228 <a class="link" href="lock.html" title="Chapter 7.  The DbLock Handle">DbLock</a>
229 </p>
230 </div>
231 <div class="sect2" lang="en" xml:lang="en">
232 <div class="titlepage">
233 <div>
234 <div>
235 <h3 class="title"><a id="idp7936696"></a>See Also</h3>
236 </div>
237 </div>
238 </div>
239 <p>
240 <a class="xref" href="lock.html#locklist" title="Locking Subsystem and Related Methods">Locking Subsystem and Related Methods</a>
241 </p>
242 </div>
243 </div>
244 <div class="navfooter">
245 <hr />
246 <table width="100%" summary="Navigation footer">
247 <tr>
248 <td width="40%" align="left"><a accesskey="p" href="envset_lk_conflicts.html">Prev</a> </td>
249 <td width="20%" align="center">
250 <a accesskey="u" href="lock.html">Up</a>
251 </td>
252 <td width="40%" align="right"> <a accesskey="n" href="envset_lk_max_lockers.html">Next</a></td>
253 </tr>
254 <tr>
255 <td width="40%" align="left" valign="top">DbEnv::set_lk_conflicts() </td>
256 <td width="20%" align="center">
257 <a accesskey="h" href="index.html">Home</a>
258 </td>
259 <td width="40%" align="right" valign="top"> DbEnv::set_lk_max_lockers()</td>
260 </tr>
261 </table>
262 </div>
263 </body>
264 </html>