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>DB_ENV->set_lg_max()</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��7.�� The DB_LSN Handle" /> 11 <link rel="prev" href="envset_lg_filemode.html" title="DB_ENV->set_lg_filemode()" /> 12 <link rel="next" href="envset_lg_regionmax.html" title="DB_ENV->set_lg_regionmax()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DB_ENV->set_lg_max()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="envset_lg_filemode.html">Prev</a>��</td> 22 <th width="60%" align="center">Chapter��7.�� 23 The DB_LSN Handle 24 </th> 25 <td width="20%" align="right">��<a accesskey="n" href="envset_lg_regionmax.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_max"></a>DB_ENV->set_lg_max()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db.h> 39 40int 41DB_ENV->set_lg_max(DB_ENV *dbenv, u_int32_t lg_max); </pre> 42 <p> 43 Set the maximum size of a single file in the log, in bytes. Because 44 <a class="link" href="lsn.html" title="Chapter��7.�� The DB_LSN Handle">DB_LSN</a> file offsets are 45 unsigned four-byte values, the set value may not be larger than the 46 maximum unsigned four-byte value. 47 </p> 48 <p> 49 When the logging subsystem is configured for on-disk logging, the 50 default size of a log file is 10MB. 51 </p> 52 <p> 53 When the logging subsystem is configured for in-memory logging, the 54 default size of a log file is 256KB. In addition, the configured log 55 buffer size must be larger than the log file size. (The logging 56 subsystem divides memory configured for in-memory log records into 57 "files", as database environments configured for in-memory log records 58 may exchange log records with other members of a replication group, 59 and those members may be configured to store log records on-disk.) 60 When choosing log buffer and file sizes for in-memory logs, 61 applications should ensure the in-memory log buffer size is large 62 enough that no transaction will ever span the entire buffer, and avoid 63 a state where the in-memory buffer is full and no space can be freed 64 because a transaction that started in the first log "file" is still 65 active. 66 </p> 67 <p> 68 See <a href="../../programmer_reference/log_limits.html" class="olink">Log File Limits</a> for 69 more information. 70 </p> 71 <p> 72 The database environment's log file size may also be configured using 73 the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. The 74 syntax of the entry in that file is a single line with the string 75 "set_lg_max", one or more whitespace characters, and the size in 76 bytes. Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is 77 read when the database environment is opened, it will silently 78 overrule configuration done before that time. 79 </p> 80 <p> 81 The <code class="methodname">DB_ENV->set_lg_max()</code> method configures a database environment, 82 not only operations performed using the specified 83 <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a> handle. 84 </p> 85 <p> 86 The <code class="methodname">DB_ENV->set_lg_max()</code> method may be called at any time during the 87 life of the application. 88 </p> 89 <p> 90 If no size is specified by the application, the size last specified 91 for the database region will be used, or if no database region 92 previously existed, the default will be used. 93 </p> 94 <p> 95 The <code class="methodname">DB_ENV->set_lg_max()</code> <span> 96 <span> 97 method returns a non-zero error value on failure and 0 on success. 98 </span> 99 100 </span> 101 </p> 102 <div class="sect2" lang="en" xml:lang="en"> 103 <div class="titlepage"> 104 <div> 105 <div> 106 <h3 class="title"><a id="id1684104"></a>Parameters</h3> 107 </div> 108 </div> 109 </div> 110 <div class="sect3" lang="en" xml:lang="en"> 111 <div class="titlepage"> 112 <div> 113 <div> 114 <h4 class="title"><a id="id1683989"></a>lg_max</h4> 115 </div> 116 </div> 117 </div> 118 <p> 119 The <span class="bold"><strong>lg_max</strong></span> parameter is the size of a 120 single log file, in bytes. 121 </p> 122 </div> 123 </div> 124 <div class="sect2" lang="en" xml:lang="en"> 125 <div class="titlepage"> 126 <div> 127 <div> 128 <h3 class="title"><a id="id1684303"></a>Errors</h3> 129 </div> 130 </div> 131 </div> 132 <p> 133 The <code class="methodname">DB_ENV->set_lg_max()</code> <span> 134 <span> 135 method may fail and return one of the following non-zero errors: 136 </span> 137 138 </span> 139 </p> 140 <div class="sect3" lang="en" xml:lang="en"> 141 <div class="titlepage"> 142 <div> 143 <div> 144 <h4 class="title"><a id="id1684236"></a>EINVAL</h4> 145 </div> 146 </div> 147 </div> 148 <p> 149 If the size of the log file is less than four 150 times the size of the in-memory log buffer; 151 the specified log file size was too large; or 152 if an invalid flag value or parameter was 153 specified. 154 </p> 155 </div> 156 </div> 157 <div class="sect2" lang="en" xml:lang="en"> 158 <div class="titlepage"> 159 <div> 160 <div> 161 <h3 class="title"><a id="id1684251"></a>Class</h3> 162 </div> 163 </div> 164 </div> 165 <p> 166 <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a>, 167 <a class="link" href="logc.html" title="The DB_LOGC Handle">DB_LOGC</a>, 168 <a class="link" href="lsn.html" title="Chapter��7.�� The DB_LSN Handle">DB_LSN</a> 169 </p> 170 </div> 171 <div class="sect2" lang="en" xml:lang="en"> 172 <div class="titlepage"> 173 <div> 174 <div> 175 <h3 class="title"><a id="id1684152"></a>See Also</h3> 176 </div> 177 </div> 178 </div> 179 <p> 180 <a class="xref" href="lsn.html#loglist" title="Logging Subsystem and Related Methods">Logging Subsystem and Related Methods</a> 181 </p> 182 </div> 183 </div> 184 <div class="navfooter"> 185 <hr /> 186 <table width="100%" summary="Navigation footer"> 187 <tr> 188 <td width="40%" align="left"><a accesskey="p" href="envset_lg_filemode.html">Prev</a>��</td> 189 <td width="20%" align="center"> 190 <a accesskey="u" href="lsn.html">Up</a> 191 </td> 192 <td width="40%" align="right">��<a accesskey="n" href="envset_lg_regionmax.html">Next</a></td> 193 </tr> 194 <tr> 195 <td width="40%" align="left" valign="top">DB_ENV->set_lg_filemode()��</td> 196 <td width="20%" align="center"> 197 <a accesskey="h" href="index.html">Home</a> 198 </td> 199 <td width="40%" align="right" valign="top">��DB_ENV->set_lg_regionmax()</td> 200 </tr> 201 </table> 202 </div> 203 </body> 204</html> 205