1<!--$Id: env_set_lg_bsize.so,v 10.36 2006/08/30 10:04:48 bostic Exp $-->
2<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
3<!--See the file LICENSE for redistribution information.-->
4<html>
5<head>
6<title>Berkeley DB: DB_ENV-&gt;set_lg_bsize</title>
7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
9</head>
10<body bgcolor=white>
11<table width="100%"><tr valign=top>
12<td>
13<b>DB_ENV-&gt;set_lg_bsize</b>
14</td>
15<td align=right>
16<a href="/api_c/api_core.html"><img src="/images/api.gif" alt="API"></a>
17<a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a></td>
18</tr></table>
19<hr size=1 noshade>
20<tt>
21<b><pre>
22#include &lt;db.h&gt;
23<p>
24int
25DB_ENV-&gt;set_lg_bsize(DB_ENV *dbenv, u_int32_t lg_bsize);
26<p>
27int
28DB_ENV-&gt;get_lg_bsize(DB_ENV *dbenv, u_int32_t *lg_bsizep);
29</pre></b>
30<hr size=1 noshade>
31<b>Description: DB_ENV-&gt;set_lg_bsize</b>
32<p>Set the size of the in-memory log buffer, in bytes.</p>
33<p>When the logging subsystem is configured for on-disk logging, the
34default size of the in-memory log buffer is approximately 32KB.  Log
35information is stored in-memory until the storage space fills up or
36transaction commit forces the information to be flushed to stable
37storage.  In the presence of long-running transactions or transactions
38producing large amounts of data, larger buffer sizes can increase
39throughput.</p>
40<p>When the logging subsystem is configured for in-memory logging, the
41default size of the in-memory log buffer is 1MB.  Log information is
42stored in-memory until the storage space fills up or transaction abort
43or commit frees up the memory for new transactions.  In the presence of
44long-running transactions or transactions producing large amounts of
45data, the buffer size must be sufficient to hold all log information
46that can accumulate during the longest running transaction.  When
47choosing log buffer and file sizes for in-memory logs, applications
48should ensure the in-memory log buffer size is large enough that no
49transaction will ever span the entire buffer, and avoid a state where
50the in-memory buffer is full and no space can be freed because a
51transaction that started in the first log "file" is still active.</p>
52<p>The database environment's log buffer size may also be configured using the
53environment's <a href="/ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file.  The syntax of the entry in that
54file is a single line with the string "set_lg_bsize", one or more whitespace
55characters, and the size in bytes.
56Because the <a href="/ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment
57is opened, it will silently overrule configuration done before that
58time.</p>
59<p>The DB_ENV-&gt;set_lg_bsize method configures a database environment, not only operations
60performed using the specified <a href="/api_c/env_class.html">DB_ENV</a> handle.</p>
61<p>The DB_ENV-&gt;set_lg_bsize method may not be called after the <a href="/api_c/env_open.html">DB_ENV-&gt;open</a> method is
62called.
63If the database environment already exists when
64<a href="/api_c/env_open.html">DB_ENV-&gt;open</a> is called, the information specified to DB_ENV-&gt;set_lg_bsize
65will be ignored.
66</p>
67<p>The DB_ENV-&gt;set_lg_bsize method
68returns a non-zero error value on failure
69and 0 on success.
70</p>
71<b>Parameters</b> <br>
72 <b>lg_bsize</b><ul compact><li>The <b>lg_bsize</b> parameter is the size of the in-memory log buffer,
73in bytes.</ul>
74<br>
75<br><b>Errors</b>
76<p>The DB_ENV-&gt;set_lg_bsize method
77may fail and return one of the following non-zero errors:</p>
78<br>
79<b>EINVAL</b><ul compact><li>An
80invalid flag value or parameter was specified.</ul>
81<br>
82<hr size=1 noshade>
83<b>Description: DB_ENV-&gt;get_lg_bsize</b>
84<p>The DB_ENV-&gt;get_lg_bsize method returns the size of the log buffer, in bytes.</p>
85<p>The DB_ENV-&gt;get_lg_bsize method may be called at any time during the life of the
86application.</p>
87<p>The DB_ENV-&gt;get_lg_bsize method
88returns a non-zero error value on failure
89and 0 on success.
90</p>
91<b>Parameters</b> <br>
92 <b>lg_bsizep</b><ul compact><li>The DB_ENV-&gt;get_lg_bsize method returns  the
93size of the log buffer, in bytes in <b>lg_bsizep</b>.</ul>
94<br>
95<hr size=1 noshade>
96<br><b>Class</b>
97<a href="/api_c/env_class.html">DB_ENV</a>, <a href="/api_c/logc_class.html">DB_LOGC</a>, <a href="/api_c/lsn_class.html">DB_LSN</a>
98<br><b>See Also</b>
99<a href="/api_c/log_list.html">Logging Subsystem and Related Methods</a>
100</tt>
101<table width="100%"><tr><td><br></td><td align=right>
102<a href="/api_c/api_core.html"><img src="/images/api.gif" alt="API"></a><a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a>
103</td></tr></table>
104<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
105</body>
106</html>
107