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