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