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: DbEnv::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>DbEnv::set_lg_bsize</b> 14</td> 15<td align=right> 16<a href="../api_cxx/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 <db_cxx.h> 23<p> 24int 25DbEnv::set_lg_bsize(u_int32_t lg_bsize); 26<p> 27int 28DbEnv::get_lg_bsize(u_int32_t *lg_bsizep); 29</pre></b> 30<hr size=1 noshade> 31<b>Description: DbEnv::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 DbEnv::set_lg_bsize method configures a database environment, not only operations 60performed using the specified <a href="../api_cxx/env_class.html">DbEnv</a> handle.</p> 61<p>The DbEnv::set_lg_bsize method may not be called after the <a href="../api_cxx/env_open.html">DbEnv::open</a> method is 62called. 63If the database environment already exists when 64<a href="../api_cxx/env_open.html">DbEnv::open</a> is called, the information specified to DbEnv::set_lg_bsize 65will be ignored. 66</p> 67<p>The DbEnv::set_lg_bsize method 68either returns a non-zero error value 69or throws an exception that encapsulates a non-zero error value on 70failure, and returns 0 on success. 71</p> 72<b>Parameters</b> <br> 73 <b>lg_bsize</b><ul compact><li>The <b>lg_bsize</b> parameter is the size of the in-memory log buffer, 74in bytes.</ul> 75<br> 76<br><b>Errors</b> 77<p>The DbEnv::set_lg_bsize method 78may fail and throw 79<a href="../api_cxx/except_class.html">DbException</a>, 80encapsulating one of the following non-zero errors, or return one of 81the following non-zero errors:</p> 82<br> 83<b>EINVAL</b><ul compact><li>An 84invalid flag value or parameter was specified.</ul> 85<br> 86<hr size=1 noshade> 87<b>Description: DbEnv::get_lg_bsize</b> 88<p>The DbEnv::get_lg_bsize method returns the size of the log buffer, in bytes.</p> 89<p>The DbEnv::get_lg_bsize method may be called at any time during the life of the 90application.</p> 91<p>The DbEnv::get_lg_bsize method 92either returns a non-zero error value 93or throws an exception that encapsulates a non-zero error value on 94failure, and returns 0 on success. 95</p> 96<b>Parameters</b> <br> 97 <b>lg_bsizep</b><ul compact><li>The DbEnv::get_lg_bsize method returns the 98size of the log buffer, in bytes in <b>lg_bsizep</b>.</ul> 99<br> 100<hr size=1 noshade> 101<br><b>Class</b> 102<a href="../api_cxx/env_class.html">DbEnv</a>, <a href="../api_cxx/logc_class.html">DbLogc</a>, <a href="../api_cxx/lsn_class.html">DbLsn</a> 103<br><b>See Also</b> 104<a href="../api_cxx/log_list.html">Logging Subsystem and Related Methods</a> 105</tt> 106<table width="100%"><tr><td><br></td><td align=right> 107<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a> 108</td></tr></table> 109<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 110</body> 111</html> 112