1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
|
<!--$Id-->
<!--Copyright 1997-2002 by Sleepycat Software, Inc.-->
<!--All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB: DB_ENV->set_flags</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
</head>
<body bgcolor=white>
<a name="2"><!--meow--></a>
<table width="100%"><tr valign=top>
<td>
<h1>DB_ENV->set_flags</h1>
</td>
<td align=right>
<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
</td></tr></table>
<hr size=1 noshade>
<tt>
<h3><pre>
#include <db.h>
<p>
int
DB_ENV->set_flags(DB_ENV *dbenv, u_int32_t flags, int onoff);
</pre></h3>
<h1>Description</h1>
<p>The <b>flags</b> value must be set to 0 or by bitwise inclusively <b>OR</b>'ing together one or
more of the following values:
If <b>onoff</b> is
zero,
the specified flags are cleared; otherwise they are set.
<p><dl compact>
<p><dt><a name="DB_AUTO_COMMIT">DB_AUTO_COMMIT</a><dd>If set, operations for which no explicit transaction handle was
specified, and which modify databases in the database environment, will
be automatically enclosed within a transaction. If the call succeeds,
changes made by the operation will be recoverable. If the call fails,
the operation will have made no changes.
<p>Calling DB_ENV->set_flags with the <a href="../api_c/env_set_flags.html#DB_AUTO_COMMIT">DB_AUTO_COMMIT</a> flag only affects
the specified <a href="../api_c/env_class.html">DB_ENV</a> handle (and any other Berkeley DB handles opened
within the scope of that handle).
For consistent behavior across the environment, all <a href="../api_c/env_class.html">DB_ENV</a>
handles opened in the environment must either set the <a href="../api_c/env_set_flags.html#DB_AUTO_COMMIT">DB_AUTO_COMMIT</a> flag
or the flag should be specified in the <b>DB_CONFIG</b> configuration
file.
<p>The <a href="../api_c/env_set_flags.html#DB_AUTO_COMMIT">DB_AUTO_COMMIT</a> flag may be used to configure Berkeley DB at any time during
the life of the application.
<a name="3"><!--meow--></a>
<p><dt><a name="DB_CDB_ALLDB">DB_CDB_ALLDB</a><dd>If set, Berkeley DB Concurrent Data Store applications will perform locking on an environment-wide
basis rather than on a per-database basis.
<p>Calling DB_ENV->set_flags with the DB_CDB_ALLDB flag only affects
the specified <a href="../api_c/env_class.html">DB_ENV</a> handle (and any other Berkeley DB handles opened
within the scope of that handle).
For consistent behavior across the environment, all <a href="../api_c/env_class.html">DB_ENV</a>
handles opened in the environment must either set the DB_CDB_ALLDB flag
or the flag should be specified in the <b>DB_CONFIG</b> configuration
file.
<p>The DB_CDB_ALLDB flag may be used to configure Berkeley DB only before the
<a href="../api_c/env_open.html">DB_ENV->open</a> interface is called.
<a name="4"><!--meow--></a>
<p><dt><a name="DB_DIRECT_DB">DB_DIRECT_DB</a><dd>If set and supported by the system, Berkeley DB will turn off system buffering
of Berkeley DB database files to avoid double caching.
<p>Calling DB_ENV->set_flags with the DB_DIRECT_DB flag only affects
the specified <a href="../api_c/env_class.html">DB_ENV</a> handle (and any other Berkeley DB handles opened
within the scope of that handle).
For consistent behavior across the environment, all <a href="../api_c/env_class.html">DB_ENV</a>
handles opened in the environment must either set the DB_DIRECT_DB flag
or the flag should be specified in the <b>DB_CONFIG</b> configuration
file.
<p>The DB_DIRECT_DB flag may be used to configure Berkeley DB at any time during
the life of the application.
<a name="5"><!--meow--></a>
<p><dt><a name="DB_DIRECT_LOG">DB_DIRECT_LOG</a><dd>If set and supported by the system, Berkeley DB will turn off system buffering
of Berkeley DB log files to avoid double caching.
<p>Calling DB_ENV->set_flags with the DB_DIRECT_LOG flag only affects
the specified <a href="../api_c/env_class.html">DB_ENV</a> handle (and any other Berkeley DB handles opened
within the scope of that handle).
For consistent behavior across the environment, all <a href="../api_c/env_class.html">DB_ENV</a>
handles opened in the environment must either set the DB_DIRECT_LOG flag
or the flag should be specified in the <b>DB_CONFIG</b> configuration
file.
<p>The DB_DIRECT_LOG flag may be used to configure Berkeley DB at any time during
the life of the application.
<a name="6"><!--meow--></a>
<p><dt><a name="DB_NOLOCKING">DB_NOLOCKING</a><dd>If set, Berkeley DB will grant all requested mutual exclusion mutexes and
database locks without regard for their actual availability. This
functionality should never be used for purposes other than debugging.
<p>Calling DB_ENV->set_flags with the DB_NOLOCKING flag only affects
the specified <a href="../api_c/env_class.html">DB_ENV</a> handle (and any other Berkeley DB handles opened
within the scope of that handle).
<p>The DB_NOLOCKING flag may be used to configure Berkeley DB at any time during
the life of the application.
<a name="7"><!--meow--></a>
<p><dt><a name="DB_NOMMAP">DB_NOMMAP</a><dd>If set, Berkeley DB will copy read-only database files into the local cache
instead of potentially mapping them into process memory (see the
description of the <a href="../api_c/env_set_mp_mmapsize.html">DB_ENV->set_mp_mmapsize</a> method for further
information).
<p>Calling DB_ENV->set_flags with the DB_NOMMAP flag only affects
the specified <a href="../api_c/env_class.html">DB_ENV</a> handle (and any other Berkeley DB handles opened
within the scope of that handle).
For consistent behavior across the environment, all <a href="../api_c/env_class.html">DB_ENV</a>
handles opened in the environment must either set the DB_NOMMAP flag
or the flag should be specified in the <b>DB_CONFIG</b> configuration
file.
<p>The DB_NOMMAP flag may be used to configure Berkeley DB at any time during
the life of the application.
<a name="8"><!--meow--></a>
<p><dt><a name="DB_NOPANIC">DB_NOPANIC</a><dd>If set, Berkeley DB will ignore any panic state in the database environment.
(Database environments in a panic state normally refuse all attempts to
call Berkeley DB functions, returning <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a>.) This
functionality should never be used for purposes other than debugging.
<p>Calling DB_ENV->set_flags with the DB_NOPANIC flag only affects
the specified <a href="../api_c/env_class.html">DB_ENV</a> handle (and any other Berkeley DB handles opened
within the scope of that handle).
<p>The DB_NOPANIC flag may be used to configure Berkeley DB at any time during
the life of the application.
<p><dt><a name="DB_OVERWRITE">DB_OVERWRITE</a><dd>Overwrite files stored in encrypted formats before deleting them. Berkeley DB
overwrites files using alternating 0xff, 0x00 and 0xff byte patterns.
For file overwriting to be effective, the underlying file must be stored
on a fixed-block filesystem. Systems with journaling or logging filesystems
will require operating system support and probably modification of the
Berkeley DB sources.
<p>Calling DB_ENV->set_flags with the DB_OVERWRITE flag only affects
the specified <a href="../api_c/env_class.html">DB_ENV</a> handle (and any other Berkeley DB handles opened
within the scope of that handle).
<p>The DB_OVERWRITE flag may be used to configure Berkeley DB at any time during
the life of the application.
<a name="9"><!--meow--></a>
<p><dt><a name="DB_PANIC_ENVIRONMENT">DB_PANIC_ENVIRONMENT</a><dd>If set, Berkeley DB will set the panic state for the database environment.
(Database environments in a panic state normally refuse all attempts to
call Berkeley DB functions, returning <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a>.) This flag may
not be specified using the environment's <b>DB_CONFIG</b> file. This
flag may be used to configure Berkeley DB only after the <a href="../api_c/env_open.html">DB_ENV->open</a>
interface is called.
<p>Calling DB_ENV->set_flags with the DB_PANIC_ENVIRONMENT flag affects the
database environment, including all threads of control accessing the
database environment.
<p>The DB_PANIC_ENVIRONMENT flag may be used to configure Berkeley DB at any time during
the life of the application.
<a name="10"><!--meow--></a>
<p><dt><a name="DB_REGION_INIT">DB_REGION_INIT</a><dd>In some applications, the expense of page-faulting the underlying shared
memory regions can affect performance. (For example, if the page-fault
occurs while holding a lock, other lock requests can convoy, and overall
throughput may decrease.) If set, Berkeley DB will page-fault shared regions
into memory when initially creating or joining a Berkeley DB environment. In
addition, Berkeley DB will write the shared regions when creating an
environment, forcing the underlying virtual memory and filesystems to
instantiate both the necessary memory and the necessary disk space.
This can also avoid out-of-disk space failures later on.
<p>Calling DB_ENV->set_flags with the DB_REGION_INIT flag only affects
the specified <a href="../api_c/env_class.html">DB_ENV</a> handle (and any other Berkeley DB handles opened
within the scope of that handle).
For consistent behavior across the environment, all <a href="../api_c/env_class.html">DB_ENV</a>
handles opened in the environment must either set the DB_REGION_INIT flag
or the flag should be specified in the <b>DB_CONFIG</b> configuration
file.
<p>The DB_REGION_INIT flag may be used to configure Berkeley DB at any time during
the life of the application.
<a name="11"><!--meow--></a>
<p><dt><a name="DB_TXN_NOSYNC">DB_TXN_NOSYNC</a><dd>If set, Berkeley DB will not write or synchronously flush the log on transaction
commit or prepare.
This means that transactions exhibit the ACI (atomicity, consistency,
and isolation) properties, but not D (durability); that is, database
integrity will be maintained, but if the application or system fails,
it is possible some number of the most recently committed transactions
may be undone during recovery. The number of transactions at risk is
governed by how many log updates can fit into the log buffer, how often
the operating system flushes dirty buffers to disk, and how often the
log is checkpointed
<p>Calling DB_ENV->set_flags with the DB_TXN_NOSYNC flag only affects
the specified <a href="../api_c/env_class.html">DB_ENV</a> handle (and any other Berkeley DB handles opened
within the scope of that handle).
For consistent behavior across the environment, all <a href="../api_c/env_class.html">DB_ENV</a>
handles opened in the environment must either set the DB_TXN_NOSYNC flag
or the flag should be specified in the <b>DB_CONFIG</b> configuration
file.
<p>The DB_TXN_NOSYNC flag may be used to configure Berkeley DB at any time during
the life of the application.
<a name="12"><!--meow--></a>
<p><dt><a name="DB_TXN_WRITE_NOSYNC">DB_TXN_WRITE_NOSYNC</a><dd>If set, Berkeley DB will write, but will not synchronously flush, the log on
transaction commit or prepare.
This means that transactions exhibit the ACI (atomicity, consistency,
and isolation) properties, but not D (durability); that is, database
integrity will be maintained, but if the system fails, it is possible
some number of the most recently committed transactions may be undone
during recovery. The number of transactions at risk is governed by how
often the system flushes dirty buffers to disk and how often the log is
checkpointed.
<p>Calling DB_ENV->set_flags with the DB_TXN_WRITE_NOSYNC flag only affects
the specified <a href="../api_c/env_class.html">DB_ENV</a> handle (and any other Berkeley DB handles opened
within the scope of that handle).
For consistent behavior across the environment, all <a href="../api_c/env_class.html">DB_ENV</a>
handles opened in the environment must either set the DB_TXN_WRITE_NOSYNC flag
or the flag should be specified in the <b>DB_CONFIG</b> configuration
file.
<p>The DB_TXN_WRITE_NOSYNC flag may be used to configure Berkeley DB at any time during
the life of the application.
<a name="13"><!--meow--></a>
<p><dt><a name="DB_YIELDCPU">DB_YIELDCPU</a><dd>If set, Berkeley DB will yield the processor immediately after each page or
mutex acquisition. This functionality should never be used for purposes
other than stress testing.
<p>Calling DB_ENV->set_flags with the DB_YIELDCPU flag only affects
the specified <a href="../api_c/env_class.html">DB_ENV</a> handle (and any other Berkeley DB handles opened
within the scope of that handle).
For consistent behavior across the environment, all <a href="../api_c/env_class.html">DB_ENV</a>
handles opened in the environment must either set the DB_YIELDCPU flag
or the flag should be specified in the <b>DB_CONFIG</b> configuration
file.
<p>The DB_YIELDCPU flag may be used to configure Berkeley DB at any time during
the life of the application.
</dl>
<p>The DB_ENV->set_flags method returns a non-zero error value on failure and 0 on success.
<p>The database environment's flag values may also be set using the environment's
<b>DB_CONFIG</b> file. The syntax of the entry in that file is a
single line with the string "set_flags", one or more whitespace characters,
and the interface flag argument as a string; for example, "set_flags
DB_TXN_NOSYNC". Because the <b>DB_CONFIG</b> file is read when the database
environment is opened, it will silently overrule configuration done
before that time.
<h1>Errors</h1>
<p>The DB_ENV->set_flags method may fail and return a non-zero error for the following conditions:
<p><dl compact>
<p><dt>EINVAL<dd>An invalid flag value or parameter was specified.
</dl>
<p>The DB_ENV->set_flags method may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions.
If a catastrophic error has occurred, the DB_ENV->set_flags method may fail and
return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a>,
in which case all subsequent Berkeley DB calls will fail in the same way.
<h1>Class</h1>
<a href="../api_c/env_class.html">DB_ENV</a>
<h1>See Also</h1>
<a href="../api_c/env_list.html">Database Environments and Related Methods</a>
</tt>
<table width="100%"><tr><td><br></td><td align=right>
<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
</td></tr></table>
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>
</body>
</html>
|