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_bsize()</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="logstat_print.html" title="DB_ENV->log_stat_print()" /> 12 <link rel="next" href="envset_lg_dir.html" title="DB_ENV->set_lg_dir()" /> 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_bsize()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="logstat_print.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_dir.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_bsize"></a>DB_ENV->set_lg_bsize()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db.h> 39 40int 41DB_ENV->set_lg_bsize(DB_ENV *dbenv, u_int32_t lg_bsize); </pre> 42 <p> 43 Set the size of the in-memory log buffer, in bytes. 44 </p> 45 <p> 46 When the logging subsystem is configured for on-disk logging, the 47 default size of the in-memory log buffer is approximately 32KB. Log 48 information is stored in-memory until the storage space fills up or 49 transaction commit forces the information to be flushed to stable 50 storage. In the presence of long-running transactions or transactions 51 producing large amounts of data, larger buffer sizes can increase 52 throughput. 53 </p> 54 <p> 55 When the logging subsystem is configured for in-memory logging, the 56 default size of the in-memory log buffer is 1MB. Log information is 57 stored in-memory until the storage space fills up or transaction abort 58 or commit frees up the memory for new transactions. In the presence 59 of long-running transactions or transactions producing large amounts 60 of data, the buffer size must be sufficient to hold all log 61 information that can accumulate during the longest running 62 transaction. When choosing log buffer and file sizes for in-memory 63 logs, applications should ensure the in-memory log buffer size is 64 large enough that no transaction will ever span the entire buffer, and 65 avoid a state where the in-memory buffer is full and no space can be 66 freed because a transaction that started in the first log "file" is 67 still active. 68 </p> 69 <p> 70 The database environment's log buffer size may also be configured 71 using the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. The 72 syntax of the entry in that file is a single line with the string 73 "set_lg_bsize", one or more whitespace characters, and the size in 74 bytes. Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is 75 read when the database environment is opened, it will silently 76 overrule configuration done before that time. 77 </p> 78 <p> 79 The <code class="methodname">DB_ENV->set_lg_bsize()</code> method configures a database environment, 80 not only operations performed using the specified <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a> handle. 81 </p> 82 <p> 83 The <code class="methodname">DB_ENV->set_lg_bsize()</code> method may not be called after the 84 <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> method is called. 85 If the database environment already exists when 86 <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> is called, the 87 information specified to <code class="methodname">DB_ENV->set_lg_bsize()</code> will be ignored. 88 </p> 89 <p> 90 The <code class="methodname">DB_ENV->set_lg_bsize()</code> <span> 91 <span> 92 method returns a non-zero error value on failure and 0 on success. 93 </span> 94 95 </span> 96 </p> 97 <div class="sect2" lang="en" xml:lang="en"> 98 <div class="titlepage"> 99 <div> 100 <div> 101 <h3 class="title"><a id="id1683443"></a>Parameters</h3> 102 </div> 103 </div> 104 </div> 105 <div class="sect3" lang="en" xml:lang="en"> 106 <div class="titlepage"> 107 <div> 108 <div> 109 <h4 class="title"><a id="id1683479"></a>lg_bsize</h4> 110 </div> 111 </div> 112 </div> 113 <p> 114 The <span class="bold"><strong>lg_bsize</strong></span> parameter is the size of 115 the in-memory log buffer, in bytes. 116 </p> 117 </div> 118 </div> 119 <div class="sect2" lang="en" xml:lang="en"> 120 <div class="titlepage"> 121 <div> 122 <div> 123 <h3 class="title"><a id="id1683561"></a>Errors</h3> 124 </div> 125 </div> 126 </div> 127 <p> 128 The <code class="methodname">DB_ENV->set_lg_bsize()</code> <span> 129 <span> 130 method may fail and return one of the following non-zero errors: 131 </span> 132 133 </span> 134 </p> 135 <div class="sect3" lang="en" xml:lang="en"> 136 <div class="titlepage"> 137 <div> 138 <div> 139 <h4 class="title"><a id="id1683595"></a>EINVAL</h4> 140 </div> 141 </div> 142 </div> 143 <p> 144 An invalid flag value or parameter was specified. 145 </p> 146 </div> 147 </div> 148 <div class="sect2" lang="en" xml:lang="en"> 149 <div class="titlepage"> 150 <div> 151 <div> 152 <h3 class="title"><a id="id1683345"></a>Class</h3> 153 </div> 154 </div> 155 </div> 156 <p> 157 <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a>, 158 <a class="link" href="logc.html" title="The DB_LOGC Handle">DB_LOGC</a>, 159 <a class="link" href="lsn.html" title="Chapter��7.�� The DB_LSN Handle">DB_LSN</a> 160 </p> 161 </div> 162 <div class="sect2" lang="en" xml:lang="en"> 163 <div class="titlepage"> 164 <div> 165 <div> 166 <h3 class="title"><a id="id1683632"></a>See Also</h3> 167 </div> 168 </div> 169 </div> 170 <p> 171 <a class="xref" href="lsn.html#loglist" title="Logging Subsystem and Related Methods">Logging Subsystem and Related Methods</a> 172 </p> 173 </div> 174 </div> 175 <div class="navfooter"> 176 <hr /> 177 <table width="100%" summary="Navigation footer"> 178 <tr> 179 <td width="40%" align="left"><a accesskey="p" href="logstat_print.html">Prev</a>��</td> 180 <td width="20%" align="center"> 181 <a accesskey="u" href="lsn.html">Up</a> 182 </td> 183 <td width="40%" align="right">��<a accesskey="n" href="envset_lg_dir.html">Next</a></td> 184 </tr> 185 <tr> 186 <td width="40%" align="left" valign="top">DB_ENV->log_stat_print()��</td> 187 <td width="20%" align="center"> 188 <a accesskey="h" href="index.html">Home</a> 189 </td> 190 <td width="40%" align="right" valign="top">��DB_ENV->set_lg_dir()</td> 191 </tr> 192 </table> 193 </div> 194 </body> 195</html> 196