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: DB_ENV->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>DB_ENV->set_lg_max</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 <db.h> 23<p> 24int 25DB_ENV->set_lg_max(DB_ENV *dbenv, u_int32_t lg_max); 26<p> 27int 28DB_ENV->get_lg_max(DB_ENV *dbenv, u_int32_t *lg_maxp); 29</pre></b> 30<hr size=1 noshade> 31<b>Description: DB_ENV->set_lg_max</b> 32<p>Set the maximum size of a single file in the log, in bytes. Because 33<a href="/api_c/lsn_class.html">DB_LSN</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 DB_ENV->set_lg_max method configures a database environment, not only operations 59performed using the specified <a href="/api_c/env_class.html">DB_ENV</a> handle.</p> 60<p>The DB_ENV->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 DB_ENV->set_lg_max method 66returns a non-zero error value on failure 67and 0 on success. 68</p> 69<b>Parameters</b> <br> 70 <b>lg_max</b><ul compact><li>The <b>lg_max</b> parameter is the size of a single log file, in bytes.</ul> 71<br> 72<br><b>Errors</b> 73<p>The DB_ENV->set_lg_max method 74may fail and return one of the following non-zero errors:</p> 75<br> 76<b>EINVAL</b><ul compact><li>If the method was called after <a href="/api_c/env_open.html">DB_ENV->open</a> was called; 77the size of the log file is less than four times the size of the in-memory 78log buffer; 79The specified log file size was too large; or if an 80invalid flag value or parameter was specified.</ul> 81<br> 82<hr size=1 noshade> 83<b>Description: DB_ENV->get_lg_max</b> 84<p>The DB_ENV->get_lg_max method returns the maximum log file size.</p> 85<p>The DB_ENV->get_lg_max method may be called at any time during the life of the 86application.</p> 87<p>The DB_ENV->get_lg_max method 88returns a non-zero error value on failure 89and 0 on success. 90</p> 91<b>Parameters</b> <br> 92 <b>lg_maxp</b><ul compact><li>The DB_ENV->get_lg_max method returns the 93maximum log file size in <b>lg_maxp</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