Debian Codegraph @

docs/api_reference/C/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>DB_ENV-&gt;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 6.  The DB_LOCK Handle" />
11 <link rel="prev" href="envset_lk_conflicts.html" title="DB_ENV-&gt;set_lk_conflicts()" />
12 <link rel="next" href="envset_lk_max_lockers.html" title="DB_ENV-&gt;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">DB_ENV-&gt;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 6. 
26 The DB_LOCK 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>DB_ENV-&gt;set_lk_detect()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db.h&gt;
42
43 int
44 DB_ENV-&gt;set_lk_detect(DB_ENV *dbenv, 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">DB_ENV-&gt;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 DB_ENV Handle">DB_ENV</a>
65 handle.
66 </p>
67 <p>
68 The <code class="methodname">DB_ENV-&gt;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">DB_ENV-&gt;set_lk_detect()</code> <span>
74 <span>
75 method returns a non-zero error value on failure and 0 on success.
76 </span>
77
78 </span>
79 </p>
80 <div class="sect2" lang="en" xml:lang="en">
81 <div class="titlepage">
82 <div>
83 <div>
84 <h3 class="title"><a id="idp52477856"></a>Parameters</h3>
85 </div>
86 </div>
87 </div>
88 <div class="sect3" lang="en" xml:lang="en">
89 <div class="titlepage">
90 <div>
91 <div>
92 <h4 class="title"><a id="idp52487840"></a>detect</h4>
93 </div>
94 </div>
95 </div>
96 <p>
97 The <span class="bold"><strong>detect</strong></span> parameter configures the
98 deadlock detector. The deadlock detector will reject the lock request
99 with the lowest priority. If multiple lock requests have the lowest
100 priority, then the <span class="bold"><strong>detect</strong></span> parameter
101 is used to select which of those lock requests to reject. The
102 specified value must be one of the following list:
103 </p>
104 <div class="itemizedlist">
105 <ul type="disc">
106 <li>
107 <p><a id="set_lk_detect_DB_LOCK_DEFAULT"></a>
108 <code class="literal">DB_LOCK_DEFAULT</code>
109 </p>
110 <p>
111 Use whatever lock policy was specified when the database environment
112 was created. If no lock policy has yet been specified, set the lock
113 policy to DB_LOCK_RANDOM.
114 </p>
115 </li>
116 <li>
117 <p><a id="set_lk_detect_DB_LOCK_EXPIRE"></a>
118 <code class="literal">DB_LOCK_EXPIRE</code>
119 </p>
120 <p>
121 Reject lock requests which have timed out. No other deadlock
122 detection is performed.
123 </p>
124 </li>
125 <li>
126 <p><a id="set_lk_detect_DB_LOCK_MAXLOCKS"></a>
127 <code class="literal">DB_LOCK_MAXLOCKS</code>
128 </p>
129 <p>
130 Reject the lock request for the locker ID with the most locks.
131 </p>
132 </li>
133 <li>
134 <p><a id="set_lk_detect_DB_LOCK_MAXWRITE"></a>
135 <code class="literal">DB_LOCK_MAXWRITE</code>
136 </p>
137 <p>
138 Reject the lock request for the locker ID with the most write locks.
139 </p>
140 </li>
141 <li>
142 <p><a id="set_lk_detect_DB_LOCK_MINLOCKS"></a>
143 <code class="literal">DB_LOCK_MINLOCKS</code>
144 </p>
145 <p>
146 Reject the lock request for the locker ID with the fewest locks.
147 </p>
148 </li>
149 <li>
150 <p><a id="set_lk_detect_DB_LOCK_MINWRITE"></a>
151 <code class="literal">DB_LOCK_MINWRITE</code>
152 </p>
153 <p>
154 Reject the lock request for the locker ID with the fewest write locks.
155 </p>
156 </li>
157 <li>
158 <p><a id="set_lk_detect_DB_LOCK_OLDEST"></a>
159 <code class="literal">DB_LOCK_OLDEST</code>
160 </p>
161 <p>
162 Reject the lock request for the locker ID with the oldest lock.
163 </p>
164 </li>
165 <li>
166 <p><a id="set_lk_detect_DB_LOCK_RANDOM"></a>
167 <code class="literal">DB_LOCK_RANDOM</code>
168 </p>
169 <p>
170 Reject the lock request for a random locker ID.
171 </p>
172 </li>
173 <li>
174 <p><a id="set_lk_detect_DB_LOCK_YOUNGEST"></a>
175 <code class="literal">DB_LOCK_YOUNGEST</code>
176 </p>
177 <p>
178 Reject the lock request for the locker ID with the youngest lock.
179 </p>
180 </li>
181 </ul>
182 </div>
183 </div>
184 </div>
185 <div class="sect2" lang="en" xml:lang="en">
186 <div class="titlepage">
187 <div>
188 <div>
189 <h3 class="title"><a id="idp52511608"></a>Errors</h3>
190 </div>
191 </div>
192 </div>
193 <p>
194 The <code class="methodname">DB_ENV-&gt;set_lk_detect()</code> <span>
195 <span>
196 method may fail and return one of the following non-zero errors:
197 </span>
198
199 </span>
200 </p>
201 <div class="sect3" lang="en" xml:lang="en">
202 <div class="titlepage">
203 <div>
204 <div>
205 <h4 class="title"><a id="idp52505096"></a>EINVAL</h4>
206 </div>
207 </div>
208 </div>
209 <p>
210 An invalid flag value or parameter was specified.
211 </p>
212 </div>
213 </div>
214 <div class="sect2" lang="en" xml:lang="en">
215 <div class="titlepage">
216 <div>
217 <div>
218 <h3 class="title"><a id="idp52503008"></a>Class</h3>
219 </div>
220 </div>
221 </div>
222 <p>
223 <a class="link" href="env.html" title="Chapter 5.  The DB_ENV Handle">DB_ENV</a>,
224 <a class="link" href="lock.html" title="Chapter 6.  The DB_LOCK Handle">DB_LOCK</a>
225 </p>
226 </div>
227 <div class="sect2" lang="en" xml:lang="en">
228 <div class="titlepage">
229 <div>
230 <div>
231 <h3 class="title"><a id="idp52506176"></a>See Also</h3>
232 </div>
233 </div>
234 </div>
235 <p>
236 <a class="xref" href="lock.html#locklist" title="Locking Subsystem and Related Methods">Locking Subsystem and Related Methods</a>
237 </p>
238 </div>
239 </div>
240 <div class="navfooter">
241 <hr />
242 <table width="100%" summary="Navigation footer">
243 <tr>
244 <td width="40%" align="left"><a accesskey="p" href="envset_lk_conflicts.html">Prev</a> </td>
245 <td width="20%" align="center">
246 <a accesskey="u" href="lock.html">Up</a>
247 </td>
248 <td width="40%" align="right"> <a accesskey="n" href="envset_lk_max_lockers.html">Next</a></td>
249 </tr>
250 <tr>
251 <td width="40%" align="left" valign="top">DB_ENV-&gt;set_lk_conflicts() </td>
252 <td width="20%" align="center">
253 <a accesskey="h" href="index.html">Home</a>
254 </td>
255 <td width="40%" align="right" valign="top"> DB_ENV-&gt;set_lk_max_lockers()</td>
256 </tr>
257 </table>
258 </div>
259 </body>
260 </html>