| 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::txn_checkpoint()</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="txn.html" title="Chapter 13. The DbTxn Handle" /> |
| 11 | <link rel="prev" href="txnbegin.html" title="DbEnv::txn_begin()" /> |
| 12 | <link rel="next" href="txnstat.html" title="DbEnv::txn_stat()" /> |
| 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">DbEnv::txn_checkpoint()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="txnbegin.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 13. |
| 26 | The DbTxn Handle |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="txnstat.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="txncheckpoint"></a>DbEnv::txn_checkpoint()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db_cxx.h> |
| 42 | |
| 43 | int |
| 44 | DbEnv::txn_checkpoint(u_int32_t kbyte, u_int32_t min, |
| 45 | u_int32_t flags) const;</pre> |
| 46 | <p> |
| 47 | If there has been any logging activity in the database environment |
| 48 | since the last checkpoint, the <code class="methodname">DbEnv::txn_checkpoint()</code> method |
| 49 | flushes the underlying memory pool, writes a checkpoint record to the |
| 50 | log, and then flushes the log. |
| 51 | </p> |
| 52 | <p> |
| 53 | The <code class="methodname">DbEnv::txn_checkpoint()</code> method returns a non-zero error value on |
| 54 | failure and 0 on success. |
| 55 | </p> |
| 56 | <p> |
| 57 | The <code class="methodname">DbEnv::txn_checkpoint()</code> method is the underlying method used by |
| 58 | the <a class="link" href="db_checkpoint.html" title="db_checkpoint">db_checkpoint</a> |
| 59 | utility. See the <a class="link" href="db_checkpoint.html" title="db_checkpoint">db_checkpoint</a> utility |
| 60 | source code for an example of using <code class="methodname">DbEnv::txn_checkpoint()</code> in a |
| 61 | IEEE/ANSI Std 1003.1 (POSIX) environment. |
| 62 | </p> |
| 63 | <div class="sect2" lang="en" xml:lang="en"> |
| 64 | <div class="titlepage"> |
| 65 | <div> |
| 66 | <div> |
| 67 | <h3 class="title"><a id="idp10300096"></a>Parameters</h3> |
| 68 | </div> |
| 69 | </div> |
| 70 | </div> |
| 71 | <div class="sect3" lang="en" xml:lang="en"> |
| 72 | <div class="titlepage"> |
| 73 | <div> |
| 74 | <div> |
| 75 | <h4 class="title"><a id="idp10311832"></a>kbyte</h4> |
| 76 | </div> |
| 77 | </div> |
| 78 | </div> |
| 79 | <p> |
| 80 | If the <span class="bold"><strong>kbyte</strong></span> parameter is non-zero, a |
| 81 | checkpoint will be done if more than <span class="bold"><strong>kbyte</strong></span> kilobytes of log data have been written |
| 82 | since the last checkpoint. |
| 83 | </p> |
| 84 | </div> |
| 85 | <div class="sect3" lang="en" xml:lang="en"> |
| 86 | <div class="titlepage"> |
| 87 | <div> |
| 88 | <div> |
| 89 | <h4 class="title"><a id="idp10347776"></a>min</h4> |
| 90 | </div> |
| 91 | </div> |
| 92 | </div> |
| 93 | <p> |
| 94 | If the <span class="bold"><strong>min</strong></span> parameter is non-zero, a |
| 95 | checkpoint will be done if more than <span class="bold"><strong>min</strong></span> minutes have passed since the last |
| 96 | checkpoint. |
| 97 | </p> |
| 98 | </div> |
| 99 | <div class="sect3" lang="en" xml:lang="en"> |
| 100 | <div class="titlepage"> |
| 101 | <div> |
| 102 | <div> |
| 103 | <h4 class="title"><a id="idp10332096"></a>flags</h4> |
| 104 | </div> |
| 105 | </div> |
| 106 | </div> |
| 107 | <p> |
| 108 | The <span class="bold"><strong>flags</strong></span> parameter must be set to 0 |
| 109 | or the following value: |
| 110 | </p> |
| 111 | <div class="itemizedlist"> |
| 112 | <ul type="disc"> |
| 113 | <li> |
| 114 | <p> |
| 115 | <code class="literal">DB_FORCE</code> |
| 116 | </p> |
| 117 | <p> |
| 118 | Force a checkpoint record, even if there has been no activity since |
| 119 | the last checkpoint. |
| 120 | </p> |
| 121 | </li> |
| 122 | </ul> |
| 123 | </div> |
| 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="idp10365360"></a>Errors</h3> |
| 131 | </div> |
| 132 | </div> |
| 133 | </div> |
| 134 | <p> |
| 135 | The <code class="methodname">DbEnv::txn_checkpoint()</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="idp10374928"></a>EINVAL</h4> |
| 149 | </div> |
| 150 | </div> |
| 151 | </div> |
| 152 | <p> |
| 153 | An invalid flag value or parameter was 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="idp10373632"></a>Class</h3> |
| 162 | </div> |
| 163 | </div> |
| 164 | </div> |
| 165 | <p> |
| 166 | <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a>, <a class="link" href="txn.html" title="Chapter 13. The DbTxn Handle">DbTxn</a> |
| 167 | </p> |
| 168 | </div> |
| 169 | <div class="sect2" lang="en" xml:lang="en"> |
| 170 | <div class="titlepage"> |
| 171 | <div> |
| 172 | <div> |
| 173 | <h3 class="title"><a id="idp10369136"></a>See Also</h3> |
| 174 | </div> |
| 175 | </div> |
| 176 | </div> |
| 177 | <p> |
| 178 | <a class="xref" href="txn.html#txnlist" title="Transaction Subsystem and Related Methods">Transaction Subsystem and Related Methods</a> |
| 179 | </p> |
| 180 | </div> |
| 181 | </div> |
| 182 | <div class="navfooter"> |
| 183 | <hr /> |
| 184 | <table width="100%" summary="Navigation footer"> |
| 185 | <tr> |
| 186 | <td width="40%" align="left"><a accesskey="p" href="txnbegin.html">Prev</a> </td> |
| 187 | <td width="20%" align="center"> |
| 188 | <a accesskey="u" href="txn.html">Up</a> |
| 189 | </td> |
| 190 | <td width="40%" align="right"> <a accesskey="n" href="txnstat.html">Next</a></td> |
| 191 | </tr> |
| 192 | <tr> |
| 193 | <td width="40%" align="left" valign="top">DbEnv::txn_begin() </td> |
| 194 | <td width="20%" align="center"> |
| 195 | <a accesskey="h" href="index.html">Home</a> |
| 196 | </td> |
| 197 | <td width="40%" align="right" valign="top"> DbEnv::txn_stat()</td> |
| 198 | </tr> |
| 199 | </table> |
| 200 | </div> |
| 201 | </body> |
| 202 | </html> |