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