1<!--$Id: env_set_lg_max.so,v 10.45 2004/09/28 15:04:21 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_max</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_max</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_max(u_int32_t lg_max); 26<p> 27int 28DbEnv::get_lg_max(u_int32_t *); 29</pre></b> 30<hr size=1 noshade> 31<b>Description: DbEnv::set_lg_max</b> 32<p>Set the maximum size of a single file in the log, in bytes. Because 33<a href="../api_cxx/lsn_class.html">DbLsn</a> file offsets are unsigned four-byte values, the set 34value may not be larger than the maximum unsigned four-byte value.</p> 35<p>When the logging subsystem is configured for on-disk logging, the 36default size of a log file is 10MB.</p> 37<p>When the logging subsystem is configured for in-memory logging, the 38default size of a log file is 256KB. In addition, the configured log 39buffer size must be larger than the log file size. (The logging 40subsystem divides memory configured for in-memory log records into 41"files", as database environments configured for in-memory log records 42may exchange log records with other members of a replication group, and 43those members may be configured to store log records on-disk.) When 44choosing log buffer and file sizes for in-memory logs, applications 45should ensure the in-memory log buffer size is large enough that no 46transaction will ever span the entire buffer, and avoid a state where 47the in-memory buffer is full and no space can be freed because a 48transaction that started in the first log "file" is still active.</p> 49<p>See <a href="../ref/log/limits.html">Log File Limits</a> for more 50information.</p> 51<p>The database environment's log file size may also be configured using the 52environment's <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file. The syntax of the entry in that 53file is a single line with the string "set_lg_max", one or more whitespace 54characters, and the size in bytes. 55Because the <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment 56is opened, it will silently overrule configuration done before that 57time.</p> 58<p>The DbEnv::set_lg_max method configures a database environment, not only operations 59performed using the specified <a href="../api_cxx/env_class.html">DbEnv</a> handle.</p> 60<p>The DbEnv::set_lg_max method may be called at any time during the life of the 61application.</p> 62If no size is specified by the application, the size last specified for 63the database region will be used, or if no database region previously 64existed, the default will be used. 65<p>The DbEnv::set_lg_max method 66either returns a non-zero error value 67or throws an exception that encapsulates a non-zero error value on 68failure, and returns 0 on success. 69</p> 70<b>Parameters</b> <br> 71 <b>lg_max</b><ul compact><li>The <b>lg_max</b> parameter is the size of a single log file, in bytes.</ul> 72<br> 73<br><b>Errors</b> 74<p>The DbEnv::set_lg_max method 75may fail and throw 76<a href="../api_cxx/except_class.html">DbException</a>, 77encapsulating one of the following non-zero errors, or return one of 78the following non-zero errors:</p> 79<br> 80<b>EINVAL</b><ul compact><li>If the method was called after <a href="../api_cxx/env_open.html">DbEnv::open</a> was called; 81the size of the log file is less than four times the size of the in-memory 82log buffer; 83The specified log file size was too large; or if an 84invalid flag value or parameter was specified.</ul> 85<br> 86<hr size=1 noshade> 87<b>Description: DbEnv::get_lg_max</b> 88<p>The DbEnv::get_lg_max method returns the maximum log file size.</p> 89<p>The DbEnv::get_lg_max method may be called at any time during the life of the 90application.</p> 91<p>The DbEnv::get_lg_max 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_maxp</b><ul compact><li>The DbEnv::get_lg_max method returns the 98maximum log file size in <b>lg_maxp</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