env_log_set_config.html   [plain text]


<!--$Id-->
<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB: DbEnv::log_set_config</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
</head>
<body bgcolor=white>
<table width="100%"><tr valign=top>
<td>
<b>DbEnv::log_set_config</b>
</td>
<td align=right>
<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a>
<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
</tr></table>
<hr size=1 noshade>
<tt>
<b><pre>
#include &lt;db_cxx.h&gt;
<p>
int
DbEnv::log_set_config(u_int32_t flags, int onoff);
<p>
int
DbEnv::log_get_config(u_int32_t which, int *onoffp)
</pre></b>
<hr size=1 noshade>
<b>Description: DbEnv::log_set_config</b>
<p>The DbEnv::log_set_config method configures the Berkeley DB logging
subsystem.</p>
<p>The DbEnv::log_set_config method configures a database environment, not only operations
performed using the specified <a href="../api_cxx/env_class.html">DbEnv</a> handle.</p>
<p>The DbEnv::log_set_config method may be called at any time during the life of the
application.</p>
<p>The DbEnv::log_set_config method
either returns a non-zero error value
or throws an exception that encapsulates a non-zero error value on
failure, and returns 0 on success.
</p>
<b>Parameters</b> <br>
 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set by bitwise inclusively <b>OR</b>'ing together one or more
of the following values:
<br>
<a name="2"><!--meow--></a>
<b><a name="DB_LOG_DIRECT">DB_LOG_DIRECT</a></b><ul compact><li>Turn off system buffering of Berkeley DB log files to avoid double caching.
<p>Calling DbEnv::log_set_config with the DB_LOG_DIRECT flag only affects
the specified <a href="../api_cxx/env_class.html">DbEnv</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_cxx/env_class.html">DbEnv</a>
handles opened in the environment must either set the DB_LOG_DIRECT flag
or the flag should be specified in the <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> configuration
file.</p>
<p>The DB_LOG_DIRECT flag may be used to configure Berkeley DB at any time during
the life of the application.</p></ul>
<a name="3"><!--meow--></a>
<b><a name="DB_LOG_DSYNC">DB_LOG_DSYNC</a></b><ul compact><li>Configure Berkeley DB to flush log writes to the backing disk before returning
from the write system call, rather than flushing log writes explicitly
in a separate system call, as necessary.  This is only available on some
systems (for example, systems supporting the IEEE/ANSI Std 1003.1 (POSIX) standard
O_DSYNC flag, or systems supporting the Windows FILE_FLAG_WRITE_THROUGH
flag).  This flag may result in inaccurate file modification times and
other file-level information for Berkeley DB log files.  This flag may offer
a performance increase on some systems and a performance decrease on
others.
<p>Calling DbEnv::log_set_config with the DB_LOG_DSYNC flag only affects
the specified <a href="../api_cxx/env_class.html">DbEnv</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_cxx/env_class.html">DbEnv</a>
handles opened in the environment must either set the DB_LOG_DSYNC flag
or the flag should be specified in the <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> configuration
file.</p>
<p>The DB_LOG_DSYNC flag may be used to configure Berkeley DB at any time during
the life of the application.</p></ul>
<a name="4"><!--meow--></a>
<b><a name="DB_LOG_AUTO_REMOVE">DB_LOG_AUTO_REMOVE</a></b><ul compact><li>If set, Berkeley DB will automatically remove log files that are no longer
needed.
<p>Automatic log file removal is likely to make catastrophic recovery
impossible.</p>
<p>Replication applications will rarely want to configure automatic log
file removal as it increases the likelihood a master will be unable to
satisfy a client's request for a recent log record.</p>
<p>Calling DbEnv::log_set_config with the DB_LOG_AUTO_REMOVE flag affects the
database environment, including all threads of control accessing the
database environment.</p>
<p>The DB_LOG_AUTO_REMOVE flag may be used to configure Berkeley DB at any time during
the life of the application.</p></ul>
<a name="5"><!--meow--></a>
<b><a name="DB_LOG_IN_MEMORY">DB_LOG_IN_MEMORY</a></b><ul compact><li>If set, maintain transaction logs in memory rather than on disk.  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,
integrity will not persist.  All database files must be verified and/or
restored from a replication group master or archival backup after
application or system failure.
<p>When in-memory logs are configured and no more log buffer space is
available, Berkeley DB methods may return an additional error value,
<a name="DB_LOG_BUFFER_FULL">DB_LOG_BUFFER_FULL</a>.  When choosing log buffer and file sizes
for in-memory logs, applications should ensure the in-memory log buffer
size is large enough that no transaction will ever span the entire
buffer, and avoid a state where the in-memory buffer is full and no
space can be freed because a transaction that started in the first log
"file" is still active.</p>
<p>Calling DbEnv::log_set_config with the DB_LOG_IN_MEMORY flag affects the
database environment, including all threads of control accessing the
database environment.</p>
<p>The DB_LOG_IN_MEMORY flag may be used to configure Berkeley DB only before the
<a href="../api_cxx/env_open.html">DbEnv::open</a> method is called.</p></ul>
<a name="6"><!--meow--></a>
<b><a name="DB_LOG_ZERO">DB_LOG_ZERO</a></b><ul compact><li>If set, zero all pages of a log file when that log file is created.  This
has shown to provide greater transaction throughput in some environments.
The log file will be zeroed by the thread which needs to re-create the new log
file.  Other threads may not write to the log file while this is happening.
<p>Calling DbEnv::log_set_config with the DB_LOG_ZERO flag affects the
database environment, including all threads of control accessing the
database environment.</p>
<p>The DB_LOG_ZERO flag may be used to configure Berkeley DB only before the
<a href="../api_cxx/env_open.html">DbEnv::open</a> method is called.</p></ul>
<br></ul>
 <b>onoff</b><ul compact><li>If the <b>onoff</b> parameter is zero, the specified flags are cleared;
otherwise they are set.</ul>
<br>
<br><b>Errors</b>
<p>The DbEnv::log_set_config method
may fail and throw
<a href="../api_cxx/except_class.html">DbException</a>,
encapsulating one of the following non-zero errors, or return one of
the following non-zero errors:</p>
<br>
<b>EINVAL</b><ul compact><li>An
invalid flag value or parameter was specified.</ul>
<br>
<hr size=1 noshade>
<b>Description: DbEnv::log_get_config</b>
<p>The DbEnv::log_get_config method returns whether the specified <b>which</b>
parameter is currently set or not.</p>
<p>The DbEnv::log_get_config method may be called at any time during the life of the
application.</p>
<p>The DbEnv::log_get_config method
either returns a non-zero error value
or throws an exception that encapsulates a non-zero error value on
failure, and returns 0 on success.
</p>
<b>Parameters</b> <br>
 <b>which</b><ul compact><li>The <b>which</b> parameter is the message value for which configuration
is being checked.</ul>
 <b>onoffp</b><ul compact><li>The <b>onoffp</b> parameter references memory into which
 the configuration of the specified <b>which</b> parameter is copied.</ul> If the returned <b>onoff</b> value is zero, the parameter is off;
otherwise on.
<br>
<hr size=1 noshade>
<br><b>Class</b>
<a href="../api_cxx/env_class.html">DbEnv</a>
<br><b>See Also</b>
<a href="../api_cxx/env_list.html">Database Environments and Related Methods</a>
</tt>
<table width="100%"><tr><td><br></td><td align=right>
<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
</td></tr></table>
<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
</body>
</html>