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>DbEnv::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 8. The DbLsn Handle" /> 11 <link rel="prev" href="envset_lg_filemode.html" title="DbEnv::set_lg_filemode()" /> 12 <link rel="next" href="envset_lg_regionmax.html" title="DbEnv::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">DbEnv::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 8. 23 The DbLsn 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>DbEnv::set_lg_max()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41DbEnv::set_lg_max(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 8. The DbLsn Handle">DbLsn</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">DbEnv::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 DbEnv Handle">DbEnv</a> handle. 84 </p> 85 <p> 86 The <code class="methodname">DbEnv::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">DbEnv::set_lg_max()</code> <span> 96 97 <span> 98 method either returns a non-zero error value or throws an 99 exception that encapsulates a non-zero error value on 100 failure, and returns 0 on success. 101 </span> 102 </span> 103 </p> 104 <div class="sect2" lang="en" xml:lang="en"> 105 <div class="titlepage"> 106 <div> 107 <div> 108 <h3 class="title"><a id="id1688241"></a>Parameters</h3> 109 </div> 110 </div> 111 </div> 112 <div class="sect3" lang="en" xml:lang="en"> 113 <div class="titlepage"> 114 <div> 115 <div> 116 <h4 class="title"><a id="id1688213"></a>lg_max</h4> 117 </div> 118 </div> 119 </div> 120 <p> 121 The <span class="bold"><strong>lg_max</strong></span> parameter is the size of a 122 single log file, in bytes. 123 </p> 124 </div> 125 </div> 126 <div class="sect2" lang="en" xml:lang="en"> 127 <div class="titlepage"> 128 <div> 129 <div> 130 <h3 class="title"><a id="id1688242"></a>Errors</h3> 131 </div> 132 </div> 133 </div> 134 <p> 135 The <code class="methodname">DbEnv::set_lg_max()</code> <span> 136 137 <span> 138 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 139 exception, encapsulating one of the following non-zero errors, or return one 140 of the following non-zero errors: 141 </span> 142 </span> 143 </p> 144 <div class="sect3" lang="en" xml:lang="en"> 145 <div class="titlepage"> 146 <div> 147 <div> 148 <h4 class="title"><a id="id1688434"></a>EINVAL</h4> 149 </div> 150 </div> 151 </div> 152 <p> 153 If the size of the log file is less than four 154 times the size of the in-memory log buffer; 155 the specified log file size was too large; or 156 if an invalid flag value or parameter was 157 specified. 158 </p> 159 </div> 160 </div> 161 <div class="sect2" lang="en" xml:lang="en"> 162 <div class="titlepage"> 163 <div> 164 <div> 165 <h3 class="title"><a id="id1688450"></a>Class</h3> 166 </div> 167 </div> 168 </div> 169 <p> 170 <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a>, 171 <a class="link" href="logc.html" title="The DbLogc Handle">DbLogc</a>, 172 <a class="link" href="lsn.html" title="Chapter 8. The DbLsn Handle">DbLsn</a> 173 </p> 174 </div> 175 <div class="sect2" lang="en" xml:lang="en"> 176 <div class="titlepage"> 177 <div> 178 <div> 179 <h3 class="title"><a id="id1688467"></a>See Also</h3> 180 </div> 181 </div> 182 </div> 183 <p> 184 <a class="xref" href="lsn.html#loglist" title="Logging Subsystem and Related Methods">Logging Subsystem and Related Methods</a> 185 </p> 186 </div> 187 </div> 188 <div class="navfooter"> 189 <hr /> 190 <table width="100%" summary="Navigation footer"> 191 <tr> 192 <td width="40%" align="left"><a accesskey="p" href="envset_lg_filemode.html">Prev</a> </td> 193 <td width="20%" align="center"> 194 <a accesskey="u" href="lsn.html">Up</a> 195 </td> 196 <td width="40%" align="right"> <a accesskey="n" href="envset_lg_regionmax.html">Next</a></td> 197 </tr> 198 <tr> 199 <td width="40%" align="left" valign="top">DbEnv::set_lg_filemode() </td> 200 <td width="20%" align="center"> 201 <a accesskey="h" href="index.html">Home</a> 202 </td> 203 <td width="40%" align="right" valign="top"> DbEnv::set_lg_regionmax()</td> 204 </tr> 205 </table> 206 </div> 207 </body> 208</html> 209