| 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_flags()</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="env.html" title="Chapter 5. The DB_ENV Handle" /> |
| 11 | <link rel="prev" href="envset_feedback.html" title="DB_ENV->set_feedback()" /> |
| 12 | <link rel="next" href="envset_intermediate_dir_mode.html" title="DB_ENV->set_intermediate_dir_mode()" /> |
| 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->set_flags()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="envset_feedback.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 5. |
| 26 | The DB_ENV Handle |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="envset_intermediate_dir_mode.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_flags"></a>DB_ENV->set_flags()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db.h> |
| 42 | |
| 43 | int |
| 44 | DB_ENV->set_flags(DB_ENV *dbenv, u_int32_t flags, int onoff); </pre> |
| 45 | <p> |
| 46 | Configure a database environment. |
| 47 | </p> |
| 48 | <p> |
| 49 | The database environment's flag values may also be configured |
| 50 | using the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. The syntax of the entry |
| 51 | in that file is a single line with the string "set_flags", one or |
| 52 | more whitespace characters, and the method flag parameter as a |
| 53 | string, and optionally one or more whitespace characters, and the |
| 54 | string "on" or "off". If the optional string is omitted, the |
| 55 | default is "on"; for example, "set_flags DB_TXN_NOSYNC" or |
| 56 | "set_flags DB_TXN_NOSYNC on". Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is read |
| 57 | when the database environment is opened, it will silently overrule |
| 58 | configuration done before that time. |
| 59 | </p> |
| 60 | <p> |
| 61 | The <code class="methodname">DB_ENV->set_flags()</code> <span> |
| 62 | <span> |
| 63 | method returns a non-zero error value on failure and 0 on success. |
| 64 | </span> |
| 65 | |
| 66 | </span> |
| 67 | </p> |
| 68 | <div class="sect2" lang="en" xml:lang="en"> |
| 69 | <div class="titlepage"> |
| 70 | <div> |
| 71 | <div> |
| 72 | <h3 class="title"><a id="idp52049216"></a>Parameters</h3> |
| 73 | </div> |
| 74 | </div> |
| 75 | </div> |
| 76 | <div class="sect3" lang="en" xml:lang="en"> |
| 77 | <div class="titlepage"> |
| 78 | <div> |
| 79 | <div> |
| 80 | <h4 class="title"><a id="idp52048112"></a>flags</h4> |
| 81 | </div> |
| 82 | </div> |
| 83 | </div> |
| 84 | <p> |
| 85 | The <span class="bold"><strong>flags</strong></span> parameter must be set by |
| 86 | bitwise inclusively <span class="bold"><strong>OR</strong></span>'ing together |
| 87 | one or more of the following values: |
| 88 | </p> |
| 89 | <div class="itemizedlist"> |
| 90 | <ul type="disc"> |
| 91 | <li> |
| 92 | <p><a id="envset_flags_DB_AUTO_COMMIT"></a> |
| 93 | <code class="literal">DB_AUTO_COMMIT</code> |
| 94 | </p> |
| 95 | <p> |
| 96 | If set, <a class="link" href="db.html" title="Chapter 2. The DB Handle">DB</a> handle |
| 97 | operations for which no explicit transaction handle was specified, and |
| 98 | which modify databases in the database environment, will be |
| 99 | automatically enclosed within a transaction. |
| 100 | </p> |
| 101 | <p> |
| 102 | Calling <code class="methodname">DB_ENV->set_flags()</code> with this flag only affects the specified |
| 103 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handle (and any other |
| 104 | Berkeley DB handles opened within the scope of that handle). For |
| 105 | consistent behavior across the environment, all |
| 106 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handles opened in the |
| 107 | environment must either set this flag |
| 108 | or the flag should be specified in the |
| 109 | <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> configuration file. |
| 110 | </p> |
| 111 | <p> |
| 112 | This flag may be used to configure Berkeley DB at any time during the life |
| 113 | of the application. |
| 114 | </p> |
| 115 | </li> |
| 116 | <li> |
| 117 | <p><a id="set_flags_DB_CDB_ALLDB"></a> |
| 118 | <code class="literal">DB_CDB_ALLDB</code> |
| 119 | </p> |
| 120 | <p> |
| 121 | If set, Berkeley DB Concurrent Data Store applications will perform |
| 122 | locking on an environment-wide basis rather than on a per-database |
| 123 | basis. |
| 124 | </p> |
| 125 | <p> |
| 126 | Calling <code class="methodname">DB_ENV->set_flags()</code> with the DB_CDB_ALLDB flag only affects |
| 127 | the specified <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> |
| 128 | handle (and any other Berkeley DB handles opened within the scope of |
| 129 | that handle). For consistent behavior across the environment, all |
| 130 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handles opened in |
| 131 | the environment must either set the DB_CDB_ALLDB flag or the flag |
| 132 | should be specified in the |
| 133 | <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> configuration file. |
| 134 | </p> |
| 135 | <p> |
| 136 | The DB_CDB_ALLDB flag may be used to configure Berkeley DB only before |
| 137 | the <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> method |
| 138 | is called. |
| 139 | </p> |
| 140 | </li> |
| 141 | <li> |
| 142 | <p><a id="set_flags_DB_DIRECT_DB"></a> |
| 143 | <code class="literal">DB_DIRECT_DB</code> |
| 144 | </p> |
| 145 | <p> |
| 146 | Turn off system buffering of Berkeley DB database files to avoid |
| 147 | double caching. |
| 148 | </p> |
| 149 | <p> |
| 150 | Calling <code class="methodname">DB_ENV->set_flags()</code> with |
| 151 | the DB_DIRECT_DB flag only affects the specified |
| 152 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handle (and any other |
| 153 | Berkeley DB handles opened within the scope of that |
| 154 | handle). For consistent behavior across the environment, |
| 155 | all <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handles opened |
| 156 | in the environment must either set the DB_DIRECT_DB flag |
| 157 | or the flag should be specified in the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> |
| 158 | configuration file. |
| 159 | </p> |
| 160 | <p> |
| 161 | The DB_DIRECT_DB flag may be used to configure Berkeley DB at any time |
| 162 | during the life of the application. |
| 163 | </p> |
| 164 | </li> |
| 165 | <li> |
| 166 | <p><a id="set_flags_DB_HOTBACKUP_IN_PROGRESS"></a> |
| 167 | <code class="literal">DB_HOTBACKUP_IN_PROGRESS</code> |
| 168 | </p> |
| 169 | <p> |
| 170 | Set this flag prior to creating a |
| 171 | hot backup of a database environment. |
| 172 | If a transaction with the bulk |
| 173 | insert optimization enabled (with the |
| 174 | <a class="xref" href="txnbegin.html#txnbegin_DB_TXN_BULK"> |
| 175 | |
| 176 | <code class="literal">DB_TXN_BULK</code> |
| 177 | </a> flag) is in progress, |
| 178 | setting the <code class="literal">DB_HOTBACKUP_IN_PROGRESS</code> flag |
| 179 | forces a checkpoint in the environment. |
| 180 | After |
| 181 | this flag is set in the environment, the bulk insert |
| 182 | optimization is disabled, until the flag is reset. |
| 183 | Using this protocol allows a hot backup procedure to |
| 184 | make a consistent copy of the database even when |
| 185 | bulk transactions are ongoing. For more information, see the |
| 186 | section on Hot Backup in the <span class="emphasis"><em>Getting Started |
| 187 | With Transaction Processing Guide</em></span> and the description of the |
| 188 | <a class="xref" href="txnbegin.html#txnbegin_DB_TXN_BULK"> |
| 189 | |
| 190 | <code class="literal">DB_TXN_BULK</code> |
| 191 | </a> flag in the |
| 192 | <a class="xref" href="txnbegin.html" title="DB_ENV->txn_begin()">DB_ENV->txn_begin()</a> method. |
| 193 | </p> |
| 194 | <p> |
| 195 | The <a class="xref" href="db_hotbackup.html" title="db_hotbackup">db_hotbackup</a> |
| 196 | utility implements the protocol described above. |
| 197 | </p> |
| 198 | </li> |
| 199 | <li> |
| 200 | <p><a id="set_flags_DB_DSYNC_DB"></a> |
| 201 | <code class="literal">DB_DSYNC_DB</code> |
| 202 | </p> |
| 203 | <p> |
| 204 | Configure Berkeley DB to flush database writes to the backing disk |
| 205 | before returning from the write system call, rather than flushing |
| 206 | database writes explicitly in a separate system call, as necessary. |
| 207 | This is only available on some systems (for example, systems |
| 208 | supporting the IEEE/ANSI Std 1003.1 (POSIX) standard O_DSYNC flag, or |
| 209 | systems supporting the Windows FILE_FLAG_WRITE_THROUGH flag). This |
| 210 | flag may result in inaccurate file modification times and other |
| 211 | file-level information for Berkeley DB database files. This flag will |
| 212 | almost certainly result in a performance decrease on most systems. |
| 213 | This flag is only applicable to certain filesysystems (for example, the |
| 214 | Veritas VxFS filesystem), where the filesystem's support for trickling |
| 215 | writes back to stable storage behaves badly (or more likely, has been |
| 216 | misconfigured). |
| 217 | </p> |
| 218 | <p> |
| 219 | Calling <code class="methodname">DB_ENV->set_flags()</code> with the DB_DSYNC_DB flag only affects |
| 220 | the specified <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> |
| 221 | handle (and any other Berkeley DB handles opened within the scope of |
| 222 | that handle). For consistent behavior across the environment, all |
| 223 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handles opened in |
| 224 | the environment must either set the DB_DSYNC_DB flag or the flag |
| 225 | should be specified in the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> configuration file. |
| 226 | </p> |
| 227 | <p> |
| 228 | The DB_DSYNC_DB flag may be used to configure Berkeley DB at any time |
| 229 | during the life of the application. |
| 230 | </p> |
| 231 | </li> |
| 232 | <li> |
| 233 | <p><a id="set_flags_DB_MULTIVERSION"></a> |
| 234 | <code class="literal">DB_MULTIVERSION</code> |
| 235 | </p> |
| 236 | <p> |
| 237 | If set, all databases in the environment will be opened as if |
| 238 | DB_MULTIVERSION is passed to the <a class="xref" href="dbopen.html" title="DB->open()">DB->open()</a> |
| 239 | method. This flag will be ignored for queue databases for which DB_MULTIVERSION is not |
| 240 | supported. |
| 241 | </p> |
| 242 | <p> |
| 243 | Calling <code class="methodname">DB_ENV->set_flags()</code> with the DB_MULTIVERSION flag only |
| 244 | affects the specified <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handle (and any other |
| 245 | Berkeley DB handles opened within the scope of that handle). For |
| 246 | consistent behavior across the environment, all <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> |
| 247 | handles opened in the environment must either set the DB_MULTIVERSION flag or the flag |
| 248 | should be specified in the |
| 249 | <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> configuration file. |
| 250 | </p> |
| 251 | <p> |
| 252 | The DB_MULTIVERSION flag may be used to configure Berkeley DB at any |
| 253 | time during the life of the application. |
| 254 | </p> |
| 255 | </li> |
| 256 | <li> |
| 257 | <p><a id="set_flags_DB_NOLOCKING"></a> |
| 258 | <code class="literal">DB_NOLOCKING</code> |
| 259 | </p> |
| 260 | <p> |
| 261 | If set, Berkeley DB will grant all requested mutual exclusion mutexes |
| 262 | and database locks without regard for their actual availability. This |
| 263 | functionality should never be used for purposes other than debugging. |
| 264 | </p> |
| 265 | <p> |
| 266 | Calling <code class="methodname">DB_ENV->set_flags()</code> with the DB_NOLOCKING flag only affects |
| 267 | the specified <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> |
| 268 | handle (and any other Berkeley DB handles opened within the scope of |
| 269 | that handle). |
| 270 | </p> |
| 271 | <p> |
| 272 | The DB_NOLOCKING flag may be used to configure Berkeley DB at any time |
| 273 | during the life of the application. |
| 274 | </p> |
| 275 | </li> |
| 276 | <li> |
| 277 | <p><a id="set_flags_DB_NOMMAP"></a> |
| 278 | <code class="literal">DB_NOMMAP</code> |
| 279 | </p> |
| 280 | <p> |
| 281 | If set, Berkeley DB will copy read-only database files into the local |
| 282 | cache instead of potentially mapping them into process memory (see the |
| 283 | description of the <a class="xref" href="envset_mp_mmapsize.html" title="DB_ENV->set_mp_mmapsize()">DB_ENV->set_mp_mmapsize()</a> |
| 284 | method for further information). |
| 285 | </p> |
| 286 | <p> |
| 287 | Calling <code class="methodname">DB_ENV->set_flags()</code> with the DB_NOMMAP flag only affects the |
| 288 | specified <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handle |
| 289 | (and any other Berkeley DB handles opened within the scope of that |
| 290 | handle). For consistent behavior across the environment, all |
| 291 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handles opened in the |
| 292 | environment must either set the DB_NOMMAP flag or the flag should be |
| 293 | specified in the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> configuration file. |
| 294 | </p> |
| 295 | <p> |
| 296 | The DB_NOMMAP flag may be used to configure Berkeley DB at any time |
| 297 | during the life of the application. |
| 298 | </p> |
| 299 | </li> |
| 300 | <li> |
| 301 | <p><a id="set_flags_DB_NOPANIC"></a> |
| 302 | <code class="literal">DB_NOPANIC</code> |
| 303 | </p> |
| 304 | <p> |
| 305 | If set, Berkeley DB will ignore any panic state in the database |
| 306 | environment. (Database environments in a panic state normally refuse |
| 307 | all attempts to call Berkeley DB functions, returning |
| 308 | <a href="../../programmer_reference/program_errorret.html#program_errorret.DB_RUNRECOVERY" class="olink">DB_RUNRECOVERY</a>.) |
| 309 | This functionality should never be used for purposes other than |
| 310 | debugging. |
| 311 | </p> |
| 312 | <p> |
| 313 | Calling <code class="methodname">DB_ENV->set_flags()</code> with the DB_NOPANIC flag only affects the |
| 314 | specified <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handle |
| 315 | (and any other Berkeley DB handles opened within the scope of that |
| 316 | handle). |
| 317 | </p> |
| 318 | <p> |
| 319 | The DB_NOPANIC flag may be used to configure Berkeley DB at any time |
| 320 | during the life of the application. |
| 321 | </p> |
| 322 | </li> |
| 323 | <li> |
| 324 | <p><a id="set_flags_DB_OVERWRITE"></a> |
| 325 | <code class="literal">DB_OVERWRITE</code> |
| 326 | </p> |
| 327 | <p> |
| 328 | Overwrite files stored in encrypted formats before deleting them. |
| 329 | Berkeley DB overwrites files using alternating 0xff, 0x00 and 0xff |
| 330 | byte patterns. For file overwriting to be effective, the underlying |
| 331 | file must be stored on a fixed-block filesystem. Systems with |
| 332 | journaling or logging filesystems will require operating system |
| 333 | support and probably modification of the Berkeley DB sources. |
| 334 | </p> |
| 335 | <p> |
| 336 | Calling <code class="methodname">DB_ENV->set_flags()</code> with the DB_OVERWRITE flag only affects |
| 337 | the specified <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> |
| 338 | handle (and any other Berkeley DB handles opened within the scope of |
| 339 | that handle). |
| 340 | </p> |
| 341 | <p> |
| 342 | The DB_OVERWRITE flag may be used to configure Berkeley DB at any time |
| 343 | during the life of the application. |
| 344 | </p> |
| 345 | </li> |
| 346 | <li> |
| 347 | <p><a id="set_flags_DB_PANIC_ENVIRONMENT"></a> |
| 348 | <code class="literal">DB_PANIC_ENVIRONMENT</code> |
| 349 | </p> |
| 350 | <p> |
| 351 | If set, Berkeley DB will set the panic state for the database |
| 352 | environment. (Database environments in a panic state normally refuse |
| 353 | all attempts to call Berkeley DB functions, returning |
| 354 | <a href="../../programmer_reference/program_errorret.html#program_errorret.DB_RUNRECOVERY" class="olink">DB_RUNRECOVERY</a>.) |
| 355 | This flag may not be specified using the environment's |
| 356 | <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. |
| 357 | </p> |
| 358 | <p> |
| 359 | Calling <code class="methodname">DB_ENV->set_flags()</code> with the DB_PANIC_ENVIRONMENT flag |
| 360 | affects the database environment, including all threads of control |
| 361 | accessing the database environment. |
| 362 | </p> |
| 363 | <p> |
| 364 | The DB_PANIC_ENVIRONMENT flag may be used to configure Berkeley DB |
| 365 | only after the <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> method is called. |
| 366 | </p> |
| 367 | </li> |
| 368 | <li> |
| 369 | <p><a id="set_flags_DB_REGION_INIT"></a> |
| 370 | <code class="literal">DB_REGION_INIT</code> |
| 371 | </p> |
| 372 | <p> |
| 373 | In some applications, the expense of page-faulting the underlying |
| 374 | shared memory regions can affect performance. (For example, if the |
| 375 | page-fault occurs while holding a lock, other lock requests can |
| 376 | convoy, and overall throughput may decrease.) If set, Berkeley DB |
| 377 | will page-fault shared regions into memory when initially creating or |
| 378 | joining a Berkeley DB environment. In addition, Berkeley DB will |
| 379 | write the shared regions when creating an environment, forcing the |
| 380 | underlying virtual memory and filesystems to instantiate both the |
| 381 | necessary memory and the necessary disk space. This can also avoid |
| 382 | out-of-disk space failures later on. |
| 383 | </p> |
| 384 | <p> |
| 385 | Calling <code class="methodname">DB_ENV->set_flags()</code> with the DB_REGION_INIT flag only affects |
| 386 | the specified <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> |
| 387 | handle (and any other Berkeley DB handles opened within the scope of |
| 388 | that handle). For consistent behavior across the environment, all |
| 389 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handles opened in |
| 390 | the environment must either set the DB_REGION_INIT flag or the flag |
| 391 | should be specified in the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> configuration file. |
| 392 | </p> |
| 393 | <p> |
| 394 | The DB_REGION_INIT flag may be used to configure Berkeley DB at any |
| 395 | time during the life of the application. |
| 396 | </p> |
| 397 | </li> |
| 398 | <li> |
| 399 | <p><a id="envset_flags_DB_TIME_NOTGRANTED"></a> |
| 400 | <code class="literal">DB_TIME_NOTGRANTED</code> |
| 401 | </p> |
| 402 | <p> |
| 403 | If set, database calls timing out based on lock or transaction timeout |
| 404 | values will return |
| 405 | <a href="../../programmer_reference/program_errorret.html#program_errorret.DB_LOCK_NOTGRANTED" class="olink">DB_LOCK_NOTGRANTED</a> |
| 406 | instead of |
| 407 | <a href="../../programmer_reference/program_errorret.html#program_errorret.DB_LOCK_DEADLOCK" class="olink">DB_LOCK_DEADLOCK</a>. |
| 408 | This allows applications to distinguish between operations which have |
| 409 | deadlocked and operations which have exceeded their time limits. |
| 410 | </p> |
| 411 | <p> |
| 412 | Calling <code class="methodname">DB_ENV->set_flags()</code> with the DB_TIME_NOTGRANTED flag only |
| 413 | affects the specified <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handle (and any other |
| 414 | Berkeley DB handles opened within the scope of that handle). For |
| 415 | consistent behavior across the environment, all |
| 416 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handles opened in the |
| 417 | environment must either set the DB_TIME_NOTGRANTED flag or the flag |
| 418 | should be specified in the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> configuration file. |
| 419 | </p> |
| 420 | <p> |
| 421 | The <code class="literal">DB_TIME_NOTGRANTED</code> flag may be used to configure Berkeley DB at |
| 422 | any time during the life of the application. |
| 423 | </p> |
| 424 | <p> |
| 425 | Note that the <a class="xref" href="lockget.html" title="DB_ENV->lock_get()">DB_ENV->lock_get()</a> |
| 426 | and <a class="xref" href="lockvec.html" title="DB_ENV->lock_vec()">DB_ENV->lock_vec()</a> |
| 427 | methods are unaffected by this flag. |
| 428 | </p> |
| 429 | </li> |
| 430 | <li> |
| 431 | <p><a id="envset_flags_DB_TXN_NOSYNC"></a> |
| 432 | <code class="literal">DB_TXN_NOSYNC</code> |
| 433 | </p> |
| 434 | <p> |
| 435 | If set, Berkeley DB will not write or synchronously flush the log on |
| 436 | transaction commit. This means that transactions exhibit the ACI |
| 437 | (atomicity, consistency, and isolation) properties, but not D |
| 438 | (durability); that is, database integrity will be maintained, but if |
| 439 | the application or system fails, it is possible some number of the |
| 440 | most recently committed transactions may be undone during recovery. |
| 441 | The number of transactions at risk is governed by how many log updates |
| 442 | can fit into the log buffer, how often the operating system flushes |
| 443 | dirty buffers to disk, and how often the log is checkpointed. |
| 444 | </p> |
| 445 | <p> |
| 446 | Calling <code class="methodname">DB_ENV->set_flags()</code> with the DB_TXN_NOSYNC flag only affects |
| 447 | the specified <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> |
| 448 | handle (and any other Berkeley DB handles opened within the scope of |
| 449 | that handle). For consistent behavior across the environment, all |
| 450 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handles opened in |
| 451 | the environment must either set the DB_TXN_NOSYNC flag or the flag |
| 452 | should be specified in the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> configuration file. |
| 453 | </p> |
| 454 | <p> |
| 455 | The DB_TXN_NOSYNC flag may be used to configure Berkeley DB at any |
| 456 | time during the life of the application. |
| 457 | </p> |
| 458 | </li> |
| 459 | <li> |
| 460 | <p><a id="set_flags_DB_TXN_NOWAIT"></a> |
| 461 | <code class="literal">DB_TXN_NOWAIT</code> |
| 462 | </p> |
| 463 | <p> |
| 464 | If set and a lock is unavailable for any Berkeley DB operation |
| 465 | performed in the context of a transaction, cause the operation to |
| 466 | return |
| 467 | <a href="../../programmer_reference/program_errorret.html#program_errorret.DB_LOCK_DEADLOCK" class="olink">DB_LOCK_DEADLOCK</a> |
| 468 | (or |
| 469 | <a href="../../programmer_reference/program_errorret.html#program_errorret.DB_LOCK_NOTGRANTED" class="olink">DB_LOCK_NOTGRANTED</a> |
| 470 | if configured using the DB_TIME_NOTGRANTED flag). |
| 471 | </p> |
| 472 | <p> |
| 473 | Calling <code class="methodname">DB_ENV->set_flags()</code> with the DB_TXN_NOWAIT flag only affects |
| 474 | the specified <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> |
| 475 | handle (and any other Berkeley DB handles opened within the scope of |
| 476 | that handle). For consistent behavior across the environment, all |
| 477 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handles opened in |
| 478 | the environment must either set the DB_TXN_NOWAIT flag or the flag |
| 479 | should be specified in the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> configuration file. |
| 480 | </p> |
| 481 | <p> |
| 482 | The DB_TXN_NOWAIT flag may be used to configure Berkeley DB at any |
| 483 | time during the life of the application. |
| 484 | </p> |
| 485 | </li> |
| 486 | <li> |
| 487 | <p><a id="set_flags_DB_TXN_SNAPSHOT"></a> |
| 488 | <code class="literal">DB_TXN_SNAPSHOT</code> |
| 489 | </p> |
| 490 | <p> |
| 491 | If set, all transactions in the environment will be started as if |
| 492 | DB_TXN_SNAPSHOT were passed to the |
| 493 | <a class="xref" href="txnbegin.html" title="DB_ENV->txn_begin()">DB_ENV->txn_begin()</a> method, and all |
| 494 | non-transactional cursors will be opened as if DB_TXN_SNAPSHOT were |
| 495 | passed to the <a class="xref" href="dbcursor.html" title="DB->cursor()">DB->cursor()</a> method. |
| 496 | </p> |
| 497 | <p> |
| 498 | Calling <code class="methodname">DB_ENV->set_flags()</code> with the DB_TXN_SNAPSHOT flag only |
| 499 | affects the specified <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> |
| 500 | handle (and any other Berkeley DB handles opened within the scope of that handle). For |
| 501 | consistent behavior across the environment, all |
| 502 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handles opened in the |
| 503 | environment must either set the DB_TXN_SNAPSHOT flag or the flag |
| 504 | should be specified in the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> configuration file. |
| 505 | </p> |
| 506 | <p> |
| 507 | The DB_TXN_SNAPSHOT flag may be used to configure Berkeley DB at any |
| 508 | time during the life of the application. |
| 509 | </p> |
| 510 | </li> |
| 511 | <li> |
| 512 | <p><a id="set_flags_DB_TXN_WRITE_NOSYNC"></a> |
| 513 | <code class="literal">DB_TXN_WRITE_NOSYNC</code> |
| 514 | </p> |
| 515 | <p> |
| 516 | If set, Berkeley DB will write, but will not synchronously flush, the |
| 517 | log on transaction commit. This means that transactions exhibit the |
| 518 | ACI (atomicity, consistency, and isolation) properties, but not D |
| 519 | (durability); that is, database integrity will be maintained, but if |
| 520 | the system fails, it is possible some number of the most recently |
| 521 | committed transactions may be undone during recovery. The number of |
| 522 | transactions at risk is governed by how often the system flushes dirty |
| 523 | buffers to disk and how often the log is checkpointed. |
| 524 | </p> |
| 525 | <p> |
| 526 | Calling <code class="methodname">DB_ENV->set_flags()</code> with the DB_TXN_WRITE_NOSYNC flag only |
| 527 | affects the specified <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> |
| 528 | handle (and any other Berkeley DB handles opened within the scope of that handle). For |
| 529 | consistent behavior across the environment, all |
| 530 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handles opened in the |
| 531 | environment must either set the DB_TXN_WRITE_NOSYNC flag or the flag |
| 532 | should be specified in the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> configuration file. |
| 533 | </p> |
| 534 | <p> |
| 535 | The DB_TXN_WRITE_NOSYNC flag may be used to configure Berkeley DB at |
| 536 | any time during the life of the application. |
| 537 | </p> |
| 538 | </li> |
| 539 | <li> |
| 540 | <p><a id="set_flags_DB_YIELDCPU"></a> |
| 541 | <code class="literal">DB_YIELDCPU</code> |
| 542 | </p> |
| 543 | <p> |
| 544 | If set, Berkeley DB will yield the processor immediately after each |
| 545 | page or mutex acquisition. This functionality should never be used |
| 546 | for purposes other than stress testing. |
| 547 | </p> |
| 548 | <p> |
| 549 | Calling <code class="methodname">DB_ENV->set_flags()</code> with the DB_YIELDCPU flag only affects |
| 550 | the specified <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> |
| 551 | handle (and any other Berkeley DB handles opened within the scope of |
| 552 | that handle). For consistent behavior across the environment, all |
| 553 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handles opened in |
| 554 | the environment must either set the DB_YIELDCPU flag or the flag |
| 555 | should be specified in the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> configuration file. |
| 556 | </p> |
| 557 | <p> |
| 558 | The DB_YIELDCPU flag may be used to configure Berkeley DB at any time |
| 559 | during the life of the application. |
| 560 | </p> |
| 561 | </li> |
| 562 | </ul> |
| 563 | </div> |
| 564 | </div> |
| 565 | <div class="sect3" lang="en" xml:lang="en"> |
| 566 | <div class="titlepage"> |
| 567 | <div> |
| 568 | <div> |
| 569 | <h4 class="title"><a id="idp52051504"></a>onoff</h4> |
| 570 | </div> |
| 571 | </div> |
| 572 | </div> |
| 573 | <p> |
| 574 | If the <span class="bold"><strong>onoff</strong></span> parameter is zero, the |
| 575 | specified flags are cleared; otherwise they are set. |
| 576 | </p> |
| 577 | </div> |
| 578 | </div> |
| 579 | <div class="sect2" lang="en" xml:lang="en"> |
| 580 | <div class="titlepage"> |
| 581 | <div> |
| 582 | <div> |
| 583 | <h3 class="title"><a id="idp52018000"></a>Errors</h3> |
| 584 | </div> |
| 585 | </div> |
| 586 | </div> |
| 587 | <p> |
| 588 | The <code class="methodname">DB_ENV->set_flags()</code> <span> |
| 589 | <span> |
| 590 | method may fail and return one of the following non-zero errors: |
| 591 | </span> |
| 592 | |
| 593 | </span> |
| 594 | </p> |
| 595 | <div class="sect3" lang="en" xml:lang="en"> |
| 596 | <div class="titlepage"> |
| 597 | <div> |
| 598 | <div> |
| 599 | <h4 class="title"><a id="idp52071912"></a>EINVAL</h4> |
| 600 | </div> |
| 601 | </div> |
| 602 | </div> |
| 603 | <p> |
| 604 | An invalid flag value or parameter was specified. |
| 605 | </p> |
| 606 | </div> |
| 607 | </div> |
| 608 | <div class="sect2" lang="en" xml:lang="en"> |
| 609 | <div class="titlepage"> |
| 610 | <div> |
| 611 | <div> |
| 612 | <h3 class="title"><a id="idp52067824"></a>Class</h3> |
| 613 | </div> |
| 614 | </div> |
| 615 | </div> |
| 616 | <p> |
| 617 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> |
| 618 | </p> |
| 619 | </div> |
| 620 | <div class="sect2" lang="en" xml:lang="en"> |
| 621 | <div class="titlepage"> |
| 622 | <div> |
| 623 | <div> |
| 624 | <h3 class="title"><a id="idp52075584"></a>See Also</h3> |
| 625 | </div> |
| 626 | </div> |
| 627 | </div> |
| 628 | <p> |
| 629 | <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a> |
| 630 | </p> |
| 631 | </div> |
| 632 | </div> |
| 633 | <div class="navfooter"> |
| 634 | <hr /> |
| 635 | <table width="100%" summary="Navigation footer"> |
| 636 | <tr> |
| 637 | <td width="40%" align="left"><a accesskey="p" href="envset_feedback.html">Prev</a> </td> |
| 638 | <td width="20%" align="center"> |
| 639 | <a accesskey="u" href="env.html">Up</a> |
| 640 | </td> |
| 641 | <td width="40%" align="right"> <a accesskey="n" href="envset_intermediate_dir_mode.html">Next</a></td> |
| 642 | </tr> |
| 643 | <tr> |
| 644 | <td width="40%" align="left" valign="top">DB_ENV->set_feedback() </td> |
| 645 | <td width="20%" align="center"> |
| 646 | <a accesskey="h" href="index.html">Home</a> |
| 647 | </td> |
| 648 | <td width="40%" align="right" valign="top"> DB_ENV->set_intermediate_dir_mode()</td> |
| 649 | </tr> |
| 650 | </table> |
| 651 | </div> |
| 652 | </body> |
| 653 | </html> |