Debian Codegraph @

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