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::log_set_config()</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="lsn.html" title="Chapter 8. The DbLsn Handle" /> 11 <link rel="prev" href="logput.html" title="DbEnv::log_put()" /> 12 <link rel="next" href="logstat.html" title="DbEnv::log_stat()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DbEnv::log_set_config()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="logput.html">Prev</a> </td> 22 <th width="60%" align="center">Chapter 8. 23 The DbLsn Handle 24 </th> 25 <td width="20%" align="right"> <a accesskey="n" href="logstat.html">Next</a></td> 26 </tr> 27 </table> 28 <hr /> 29 </div> 30 <div class="sect1" lang="en" xml:lang="en"> 31 <div class="titlepage"> 32 <div> 33 <div> 34 <h2 class="title" style="clear: both"><a id="envlog_set_config"></a>DbEnv::log_set_config()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41DbEnv::log_set_config(u_int32_t flags, int onoff); </pre> 42 <p> 43 The <code class="methodname">DbEnv::log_set_config()</code> method configures the Berkeley DB 44 logging subsystem. 45 </p> 46 <p> 47 The <code class="methodname">DbEnv::log_set_config()</code> method configures a database 48 environment, not only operations performed using the specified 49 <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> handle. 50 </p> 51 <p> 52 The <code class="methodname">DbEnv::log_set_config()</code> method may be called at any time during 53 the life of the application. 54 </p> 55 <p> 56 The <code class="methodname">DbEnv::log_set_config()</code> <span> 57 58 <span> 59 method either returns a non-zero error value or throws an 60 exception that encapsulates a non-zero error value on 61 failure, and returns 0 on success. 62 </span> 63 </span> 64 </p> 65 <div class="sect2" lang="en" xml:lang="en"> 66 <div class="titlepage"> 67 <div> 68 <div> 69 <h3 class="title"><a id="id1686373"></a>Parameters</h3> 70 </div> 71 </div> 72 </div> 73 <div class="sect3" lang="en" xml:lang="en"> 74 <div class="titlepage"> 75 <div> 76 <div> 77 <h4 class="title"><a id="id1686298"></a>flags</h4> 78 </div> 79 </div> 80 </div> 81 <p> 82 The <span class="bold"><strong>flags</strong></span> parameter must be set by 83 bitwise inclusively <span class="bold"><strong>OR</strong></span>'ing together 84 one or more of the following values: 85 </p> 86 <div class="itemizedlist"> 87 <ul type="disc"> 88 <li> 89 <p><a id="log_set_config_DB_LOG_DIRECT"></a> 90 <code class="literal">DB_LOG_DIRECT</code> 91 </p> 92 <p> 93 Turn off system buffering of Berkeley DB log files to avoid double 94 caching. 95 </p> 96 <p> 97 Calling <code class="methodname">DbEnv::log_set_config()</code> with the DB_LOG_DIRECT flag only 98 affects the specified <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> handle (and any other 99 Berkeley DB handles opened within the scope of that handle). For 100 consistent behavior across the environment, all 101 <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> handles opened in the 102 environment must either set the DB_LOG_DIRECT flag or the flag should 103 be specified in the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> 104 configuration file. 105 </p> 106 <p> 107 The <code class="literal">DB_LOG_DIRECT</code> flag may be used to configure Berkeley DB at any 108 time during the life of the application. 109 </p> 110 </li> 111 <li> 112 <p><a id="log_set_config_DB_LOG_DSYNC"></a> 113 <code class="literal">DB_LOG_DSYNC</code> 114 </p> 115 <p> 116 Configure Berkeley DB to flush log writes to the backing disk before 117 returning from the write system call, rather than flushing log writes 118 explicitly in a separate system call, as necessary. This is only 119 available on some systems (for example, systems supporting the 120 IEEE/ANSI Std 1003.1 (POSIX) standard O_DSYNC flag, or systems 121 supporting the Windows FILE_FLAG_WRITE_THROUGH flag). This flag may 122 result in inaccurate file modification times and other file-level 123 information for Berkeley DB log files. This flag may offer a 124 performance increase on some systems and a performance decrease on 125 others. 126 </p> 127 <p> 128 Calling <code class="methodname">DbEnv::log_set_config()</code> with the DB_LOG_DSYNC flag only 129 affects the specified <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> handle (and any other 130 Berkeley DB handles opened within the scope of that handle). For 131 consistent behavior across the environment, all 132 <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> handles opened in the 133 environment must either set the DB_LOG_DSYNC flag or the flag should 134 be specified in the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> 135 configuration file. 136 </p> 137 <p> 138 The <code class="literal">DB_LOG_DSYNC</code> flag may be used to configure Berkeley DB at any time 139 during the life of the application. 140 </p> 141 </li> 142 <li> 143 <p><a id="log_set_config_DB_LOG_AUTO_REMOVE"></a> 144 <code class="literal">DB_LOG_AUTO_REMOVE</code> 145 </p> 146 <p> 147 If set, Berkeley DB will automatically remove log files that are no 148 longer needed. 149 </p> 150 <p> 151 Automatic log file removal is likely to make catastrophic recovery 152 impossible. 153 </p> 154 <p> 155 Replication applications will rarely want to configure automatic log 156 file removal as it increases the likelihood a master will be unable to 157 satisfy a client's request for a recent log record. 158 </p> 159 <p> 160 Calling <code class="methodname">DbEnv::log_set_config()</code> with the 161 <code class="literal">DB_LOG_AUTO_REMOVE</code> flag 162 affects the database environment, including all threads of control 163 accessing the database environment. 164 </p> 165 <p> 166 The <code class="literal">DB_LOG_AUTO_REMOVE</code> flag may be used to configure Berkeley DB at 167 any time during the life of the application. 168 </p> 169 </li> 170 <li> 171 <p><a id="log_set_config_DB_LOG_IN_MEMORY"></a> 172 <code class="literal">DB_LOG_IN_MEMORY</code> 173 </p> 174 <p> 175 If set, maintain transaction logs in memory rather than on disk. This 176 means that transactions exhibit the ACI (atomicity, consistency, and 177 isolation) properties, but not D (durability); that is, database 178 integrity will be maintained, but if the application or system fails, 179 integrity will not persist. All database files must be verified 180 and/or restored from a replication group master or archival backup 181 after application or system failure. 182 </p> 183 <p> 184 When in-memory logs are configured and no more log buffer space is 185 available, Berkeley DB methods may return an additional error value, 186 <code class="literal">DB_LOG_BUFFER_FULL</code>. When 187 choosing log buffer and file sizes for in-memory logs, applications 188 should ensure the in-memory log buffer size is large enough that no 189 transaction will ever span the entire buffer, and avoid a state where 190 the in-memory buffer is full and no space can be freed because a 191 transaction that started in the first log "file" is still active. 192 </p> 193 <p> 194 Calling <code class="methodname">DbEnv::log_set_config()</code> with the 195 <code class="literal">DB_LOG_IN_MEMORY</code> flag 196 affects the database environment, including all threads of control 197 accessing the database environment. 198 </p> 199 <p> 200 The <code class="literal">DB_LOG_IN_MEMORY</code> flag may be used to configure Berkeley DB only 201 before the <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> 202 method is called. 203 </p> 204 </li> 205 <li> 206 <p> 207 <code class="literal">DB_LOG_ZERO</code> 208 </p> 209 <p> 210 If set, zero all pages of a log file when that log file is created. 211 This has shown to provide greater transaction throughput in some 212 environments. The log file will be zeroed by the thread which needs to 213 re-create the new log file. Other threads may not write to the log 214 file while this is happening. 215 </p> 216 <p> 217 Calling <code class="methodname">DbEnv::log_set_config()</code> with the 218 <code class="literal">DB_LOG_ZERO</code> flag affects only the current environment handle. 219 </p> 220 <p> 221 The <code class="literal">DB_LOG_ZERO</code> flag may be used to configure Berkeley DB at any time. 222 </p> 223 </li> 224 </ul> 225 </div> 226 </div> 227 <div class="sect3" lang="en" xml:lang="en"> 228 <div class="titlepage"> 229 <div> 230 <div> 231 <h4 class="title"><a id="id1686741"></a>onoff</h4> 232 </div> 233 </div> 234 </div> 235 <p> 236 If the <span class="bold"><strong>onoff</strong></span> parameter is zero, the 237 specified flags are cleared; otherwise they are set. 238 </p> 239 </div> 240 </div> 241 <div class="sect2" lang="en" xml:lang="en"> 242 <div class="titlepage"> 243 <div> 244 <div> 245 <h3 class="title"><a id="id1686848"></a>Errors</h3> 246 </div> 247 </div> 248 </div> 249 <p> 250 The <code class="methodname">DbEnv::log_set_config()</code> <span> 251 252 <span> 253 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 254 exception, encapsulating one of the following non-zero errors, or return one 255 of the following non-zero errors: 256 </span> 257 </span> 258 </p> 259 <div class="sect3" lang="en" xml:lang="en"> 260 <div class="titlepage"> 261 <div> 262 <div> 263 <h4 class="title"><a id="id1686458"></a>EINVAL</h4> 264 </div> 265 </div> 266 </div> 267 <p> 268 An invalid flag value or parameter was specified. 269 </p> 270 </div> 271 </div> 272 <div class="sect2" lang="en" xml:lang="en"> 273 <div class="titlepage"> 274 <div> 275 <div> 276 <h3 class="title"><a id="id1686503"></a>Class</h3> 277 </div> 278 </div> 279 </div> 280 <p> 281 <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> 282 </p> 283 </div> 284 <div class="sect2" lang="en" xml:lang="en"> 285 <div class="titlepage"> 286 <div> 287 <div> 288 <h3 class="title"><a id="id1686673"></a>See Also</h3> 289 </div> 290 </div> 291 </div> 292 <p> 293 <a class="xref" href="lsn.html#loglist" title="Logging Subsystem and Related Methods">Logging Subsystem and Related Methods</a> 294 </p> 295 </div> 296 </div> 297 <div class="navfooter"> 298 <hr /> 299 <table width="100%" summary="Navigation footer"> 300 <tr> 301 <td width="40%" align="left"><a accesskey="p" href="logput.html">Prev</a> </td> 302 <td width="20%" align="center"> 303 <a accesskey="u" href="lsn.html">Up</a> 304 </td> 305 <td width="40%" align="right"> <a accesskey="n" href="logstat.html">Next</a></td> 306 </tr> 307 <tr> 308 <td width="40%" align="left" valign="top">DbEnv::log_put() </td> 309 <td width="20%" align="center"> 310 <a accesskey="h" href="index.html">Home</a> 311 </td> 312 <td width="40%" align="right" valign="top"> DbEnv::log_stat()</td> 313 </tr> 314 </table> 315 </div> 316 </body> 317</html> 318