| 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_deadlock</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="utilities.html" title="Appendix A. Berkeley DB Command Line Utilities" /> |
| 11 | <link rel="prev" href="db_checkpoint.html" title="db_checkpoint" /> |
| 12 | <link rel="next" href="db_dump.html" title="db_dump" /> |
| 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_deadlock</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="db_checkpoint.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Appendix A. |
| 26 | Berkeley DB Command Line Utilities |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="db_dump.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="db_deadlock"></a>db_deadlock</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">db_deadlock [-Vv] |
| 42 | [-a e | m | n | o | W | w | y] [-h home] [-L file] [-t sec.usec] </pre> |
| 43 | <p> |
| 44 | The <span class="command"><strong>db_deadlock</strong></span> utility traverses the database environment lock |
| 45 | region, and aborts a lock request each time it detects a deadlock or a |
| 46 | lock request that has timed out. By default, in the case of a |
| 47 | deadlock, a random lock request is chosen to be aborted. |
| 48 | </p> |
| 49 | <p> |
| 50 | This utility should be run as a background daemon, or the underlying |
| 51 | Berkeley DB deadlock detection interfaces should be called in some |
| 52 | other way, whenever there are multiple threads or processes accessing |
| 53 | a database and at least one of them is modifying it. |
| 54 | </p> |
| 55 | <p> |
| 56 | The options are as follows: |
| 57 | </p> |
| 58 | <div class="itemizedlist"> |
| 59 | <ul type="disc"> |
| 60 | <li> |
| 61 | <p> |
| 62 | <span class="bold"><strong>-a</strong></span> |
| 63 | </p> |
| 64 | <p> |
| 65 | When a deadlock is detected, abort the locker: |
| 66 | </p> |
| 67 | <div class="itemizedlist"> |
| 68 | <ul type="circle"> |
| 69 | <li> |
| 70 | <p> |
| 71 | <span class="bold"><strong>m</strong></span> |
| 72 | </p> |
| 73 | <p> |
| 74 | with the most locks |
| 75 | </p> |
| 76 | </li> |
| 77 | <li> |
| 78 | <p> |
| 79 | <span class="bold"><strong>n</strong></span> |
| 80 | </p> |
| 81 | <p> |
| 82 | with the fewest locks |
| 83 | </p> |
| 84 | </li> |
| 85 | <li> |
| 86 | <p> |
| 87 | <span class="bold"><strong>o</strong></span> |
| 88 | </p> |
| 89 | <p> |
| 90 | with the oldest locks |
| 91 | </p> |
| 92 | </li> |
| 93 | <li> |
| 94 | <p> |
| 95 | <span class="bold"><strong>W</strong></span> |
| 96 | </p> |
| 97 | <p> |
| 98 | with the most write locks |
| 99 | </p> |
| 100 | </li> |
| 101 | <li> |
| 102 | <p> |
| 103 | <span class="bold"><strong>w</strong></span> |
| 104 | </p> |
| 105 | <p> |
| 106 | with the fewest write locks |
| 107 | </p> |
| 108 | </li> |
| 109 | <li> |
| 110 | <p> |
| 111 | <span class="bold"><strong>y</strong></span> |
| 112 | </p> |
| 113 | <p> |
| 114 | with the youngest locks |
| 115 | </p> |
| 116 | </li> |
| 117 | <li> |
| 118 | <p> |
| 119 | <span class="bold"><strong>e</strong></span> |
| 120 | </p> |
| 121 | <p> |
| 122 | When lock or transaction timeouts have been specified, abort any lock |
| 123 | request that has timed out. Note that this option |
| 124 | does not perform the entire deadlock detection |
| 125 | algorithm, but instead only checks for timeouts. |
| 126 | </p> |
| 127 | </li> |
| 128 | </ul> |
| 129 | </div> |
| 130 | </li> |
| 131 | <li> |
| 132 | <p> |
| 133 | <span class="bold"><strong>-h</strong></span> |
| 134 | </p> |
| 135 | <p> |
| 136 | Specify a home directory for the database environment; by default, the |
| 137 | current working directory is used. |
| 138 | </p> |
| 139 | </li> |
| 140 | <li> |
| 141 | <p> |
| 142 | <span class="bold"><strong>-L</strong></span> |
| 143 | </p> |
| 144 | <p> |
| 145 | Log the execution of the <span class="command"><strong>db_deadlock</strong></span> utility to the specified file in |
| 146 | the following format, where <span class="emphasis"><em>###</em></span> is the process |
| 147 | ID, and the date is the time the utility was started. |
| 148 | </p> |
| 149 | <pre class="programlisting"> db_deadlock: ### Wed Jun 15 01:23:45 EDT 1995 </pre> |
| 150 | <p> |
| 151 | This file will be removed if the <span class="command"><strong>db_deadlock</strong></span> |
| 152 | utility exits gracefully. |
| 153 | </p> |
| 154 | </li> |
| 155 | <li> |
| 156 | <p> |
| 157 | <span class="bold"><strong>-t</strong></span> |
| 158 | </p> |
| 159 | <p> |
| 160 | Check the database environment every <span class="bold"><strong>sec</strong></span> seconds plus <span class="bold"><strong>usec</strong></span> microseconds to see if a process has been |
| 161 | forced to wait for a lock; if one has, review the database environment |
| 162 | lock structures. |
| 163 | </p> |
| 164 | </li> |
| 165 | <li> |
| 166 | <p> |
| 167 | <span class="bold"><strong>-V</strong></span> |
| 168 | </p> |
| 169 | <p> |
| 170 | Write the library version number to the standard output, and exit. |
| 171 | </p> |
| 172 | </li> |
| 173 | <li> |
| 174 | <p> |
| 175 | <span class="bold"><strong>-v</strong></span> |
| 176 | </p> |
| 177 | <p> |
| 178 | Run in verbose mode, generating messages each time the detector runs. |
| 179 | </p> |
| 180 | </li> |
| 181 | </ul> |
| 182 | </div> |
| 183 | <p> |
| 184 | If the <span class="bold"><strong>-t</strong></span> option is not specified, |
| 185 | <span class="command"><strong>db_deadlock</strong></span> will run once and exit. |
| 186 | </p> |
| 187 | <p> |
| 188 | The <span class="command"><strong>db_deadlock</strong></span> utility uses a Berkeley DB environment (as described |
| 189 | for the <span class="bold"><strong>-h</strong></span> option, the environment |
| 190 | variable <span class="bold"><strong>DB_HOME</strong></span>, or because the |
| 191 | utility was run in a directory containing a Berkeley DB environment). |
| 192 | In order to avoid environment corruption when using a Berkeley DB |
| 193 | environment, <span class="command"><strong>db_deadlock</strong></span> should always be given the chance to detach |
| 194 | from the environment and exit gracefully. To cause <span class="command"><strong>db_deadlock</strong></span> to |
| 195 | release all environment resources and exit cleanly, send it an |
| 196 | interrupt signal (SIGINT). |
| 197 | </p> |
| 198 | <p> |
| 199 | The <span class="command"><strong>db_deadlock</strong></span> utility does not attempt to create the Berkeley DB |
| 200 | shared memory regions if they do not already exist. The application |
| 201 | which creates the region should be started first, and then, once the |
| 202 | region is created, the <span class="command"><strong>db_deadlock</strong></span> utility should be started. |
| 203 | </p> |
| 204 | <p> |
| 205 | The <span class="command"><strong>db_deadlock</strong></span> utility exits 0 on success, and >0 if an error |
| 206 | occurs. |
| 207 | </p> |
| 208 | <div class="sect2" lang="en" xml:lang="en"> |
| 209 | <div class="titlepage"> |
| 210 | <div> |
| 211 | <div> |
| 212 | <h3 class="title"><a id="idp10612936"></a>Environment Variables</h3> |
| 213 | </div> |
| 214 | </div> |
| 215 | </div> |
| 216 | <div class="sect3" lang="en" xml:lang="en"> |
| 217 | <div class="titlepage"> |
| 218 | <div> |
| 219 | <div> |
| 220 | <h4 class="title"><a id="idp10613128"></a>DB_HOME</h4> |
| 221 | </div> |
| 222 | </div> |
| 223 | </div> |
| 224 | <p> |
| 225 | If the <span class="bold"><strong>-h</strong></span> option is not specified and |
| 226 | the environment variable DB_HOME is set, it is used as the path of the |
| 227 | database home, as described in the |
| 228 | <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> method. |
| 229 | </p> |
| 230 | </div> |
| 231 | </div> |
| 232 | </div> |
| 233 | <div class="navfooter"> |
| 234 | <hr /> |
| 235 | <table width="100%" summary="Navigation footer"> |
| 236 | <tr> |
| 237 | <td width="40%" align="left"><a accesskey="p" href="db_checkpoint.html">Prev</a> </td> |
| 238 | <td width="20%" align="center"> |
| 239 | <a accesskey="u" href="utilities.html">Up</a> |
| 240 | </td> |
| 241 | <td width="40%" align="right"> <a accesskey="n" href="db_dump.html">Next</a></td> |
| 242 | </tr> |
| 243 | <tr> |
| 244 | <td width="40%" align="left" valign="top">db_checkpoint </td> |
| 245 | <td width="20%" align="center"> |
| 246 | <a accesskey="h" href="index.html">Home</a> |
| 247 | </td> |
| 248 | <td width="40%" align="right" valign="top"> db_dump</td> |
| 249 | </tr> |
| 250 | </table> |
| 251 | </div> |
| 252 | </body> |
| 253 | </html> |