• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src/router/db-4.8.30/docs/api_reference/CXX/
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::set_lg_bsize()</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="logstat_print.html" title="DbEnv::log_stat_print()" />
12    <link rel="next" href="envset_lg_dir.html" title="DbEnv::set_lg_dir()" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">DbEnv::set_lg_bsize()</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="logstat_print.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="envset_lg_dir.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="envset_lg_bsize"></a>DbEnv::set_lg_bsize()</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">#include &lt;db_cxx.h&gt;
39
40int
41DbEnv::set_lg_bsize(u_int32_t lg_bsize); </pre>
42      <p>
43        Set the size of the in-memory log buffer, in bytes.
44    </p>
45      <p>
46         When the logging subsystem is configured for on-disk logging, the
47         default size of the in-memory log buffer is approximately 32KB.  Log
48         information is stored in-memory until the storage space fills up or
49         transaction commit forces the information to be flushed to stable
50         storage.  In the presence of long-running transactions or transactions
51         producing large amounts of data, larger buffer sizes can increase
52         throughput.
53    </p>
54      <p>
55         When the logging subsystem is configured for in-memory logging, the
56         default size of the in-memory log buffer is 1MB.  Log information is
57         stored in-memory until the storage space fills up or transaction abort
58         or commit frees up the memory for new transactions.  In the presence
59         of long-running transactions or transactions producing large amounts
60         of data, the buffer size must be sufficient to hold all log
61         information that can accumulate during the longest running
62         transaction.  When choosing log buffer and file sizes for in-memory
63         logs, applications should ensure the in-memory log buffer size is
64         large enough that no transaction will ever span the entire buffer, and
65         avoid a state where the in-memory buffer is full and no space can be
66         freed because a transaction that started in the first log "file" is
67         still active.
68    </p>
69      <p>
70         The database environment's log buffer size may also be configured
71         using the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file.  The
72         syntax of the entry in that file is a single line with the string
73         "set_lg_bsize", one or more whitespace characters, and the size in
74         bytes. Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is
75         read when the database environment is opened, it will silently
76         overrule configuration done before that time.
77    </p>
78      <p>
79         The <code class="methodname">DbEnv::set_lg_bsize()</code> method configures a database environment,
80         not only operations performed using the specified <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>  handle.
81    </p>
82      <p>
83         The <code class="methodname">DbEnv::set_lg_bsize()</code> method may not be called after the 
84         <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a>  method is called.
85         If the database environment already exists when 
86         <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a>  is called, the
87         information specified to <code class="methodname">DbEnv::set_lg_bsize()</code> will be ignored.
88    </p>
89      <p>
90         The <code class="methodname">DbEnv::set_lg_bsize()</code> <span>
91            
92            <span>
93                method either returns a non-zero error value or throws an
94                exception that encapsulates a non-zero error value on
95                failure, and returns 0 on success.
96            </span>
97        </span>
98    </p>
99      <div class="sect2" lang="en" xml:lang="en">
100        <div class="titlepage">
101          <div>
102            <div>
103              <h3 class="title"><a id="id1687563"></a>Parameters</h3>
104            </div>
105          </div>
106        </div>
107        <div class="sect3" lang="en" xml:lang="en">
108          <div class="titlepage">
109            <div>
110              <div>
111                <h4 class="title"><a id="id1687680"></a>lg_bsize</h4>
112              </div>
113            </div>
114          </div>
115          <p>
116                          The <span class="bold"><strong>lg_bsize</strong></span> parameter is the size of
117                          the in-memory log buffer, in bytes.
118                     </p>
119        </div>
120      </div>
121      <div class="sect2" lang="en" xml:lang="en">
122        <div class="titlepage">
123          <div>
124            <div>
125              <h3 class="title"><a id="id1687768"></a>Errors</h3>
126            </div>
127          </div>
128        </div>
129        <p>
130                         The <code class="methodname">DbEnv::set_lg_bsize()</code> <span>
131            
132            <span>
133                method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 
134                exception, encapsulating one of the following non-zero errors, or return one
135                of the following non-zero errors:
136            </span>
137        </span>
138                    </p>
139        <div class="sect3" lang="en" xml:lang="en">
140          <div class="titlepage">
141            <div>
142              <div>
143                <h4 class="title"><a id="id1687753"></a>EINVAL</h4>
144              </div>
145            </div>
146          </div>
147          <p>
148                An invalid flag value or parameter was specified.
149            </p>
150        </div>
151      </div>
152      <div class="sect2" lang="en" xml:lang="en">
153        <div class="titlepage">
154          <div>
155            <div>
156              <h3 class="title"><a id="id1687756"></a>Class</h3>
157            </div>
158          </div>
159        </div>
160        <p>
161                    <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>, 
162                    <a class="link" href="logc.html" title="The DbLogc Handle">DbLogc</a>,
163                    <a class="link" href="lsn.html" title="Chapter 8.  The DbLsn Handle">DbLsn</a> 
164            </p>
165      </div>
166      <div class="sect2" lang="en" xml:lang="en">
167        <div class="titlepage">
168          <div>
169            <div>
170              <h3 class="title"><a id="id1687838"></a>See Also</h3>
171            </div>
172          </div>
173        </div>
174        <p>
175                     <a class="xref" href="lsn.html#loglist" title="Logging Subsystem and Related Methods">Logging Subsystem and Related Methods</a> 
176                </p>
177      </div>
178    </div>
179    <div class="navfooter">
180      <hr />
181      <table width="100%" summary="Navigation footer">
182        <tr>
183          <td width="40%" align="left"><a accesskey="p" href="logstat_print.html">Prev</a> </td>
184          <td width="20%" align="center">
185            <a accesskey="u" href="lsn.html">Up</a>
186          </td>
187          <td width="40%" align="right"> <a accesskey="n" href="envset_lg_dir.html">Next</a></td>
188        </tr>
189        <tr>
190          <td width="40%" align="left" valign="top">DbEnv::log_stat_print() </td>
191          <td width="20%" align="center">
192            <a accesskey="h" href="index.html">Home</a>
193          </td>
194          <td width="40%" align="right" valign="top"> DbEnv::set_lg_dir()</td>
195        </tr>
196      </table>
197    </div>
198  </body>
199</html>
200