Debian Codegraph @

docs/api_reference/CXX/envlog_set_config.html

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