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->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 12. The DB_TXN Handle" /> 11 <link rel="prev" href="txnbegin.html" title="DB_ENV->txn_begin()" /> 12 <link rel="next" href="txncommit.html" title="DB_TXN->commit()" /> 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->txn_checkpoint()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="txnbegin.html">Prev</a> </td> 22 <th width="60%" align="center">Chapter 12. 23 The DB_TXN Handle 24 </th> 25 <td width="20%" align="right"> <a accesskey="n" href="txncommit.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="txncheckpoint"></a>DB_ENV->txn_checkpoint()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db.h> 39 40int 41DB_ENV->txn_checkpoint(const DB_ENV *env, 42 u_int32_t kbyte, u_int32_t min, u_int32_t flags); </pre> 43 <p> 44 If there has been any logging activity in the database environment 45 since the last checkpoint, the <code class="methodname">DB_ENV->txn_checkpoint()</code> method 46 flushes the underlying memory pool, writes a checkpoint record to the 47 log, and then flushes the log. 48 </p> 49 <p> 50 The <code class="methodname">DB_ENV->txn_checkpoint()</code> method returns a non-zero error value on 51 failure and 0 on success. 52 </p> 53 <p> 54 The <code class="methodname">DB_ENV->txn_checkpoint()</code> method is the underlying method used by 55 the <a class="link" href="db_checkpoint.html" title="db_checkpoint">db_checkpoint</a> 56 utility. See the <a class="link" href="db_checkpoint.html" title="db_checkpoint">db_checkpoint</a> utility 57 source code for an example of using <code class="methodname">DB_ENV->txn_checkpoint()</code> in a 58 IEEE/ANSI Std 1003.1 (POSIX) environment. 59 </p> 60 <div class="sect2" lang="en" xml:lang="en"> 61 <div class="titlepage"> 62 <div> 63 <div> 64 <h3 class="title"><a id="id1708563"></a>Parameters</h3> 65 </div> 66 </div> 67 </div> 68 <div class="sect3" lang="en" xml:lang="en"> 69 <div class="titlepage"> 70 <div> 71 <div> 72 <h4 class="title"><a id="id1708455"></a>flags</h4> 73 </div> 74 </div> 75 </div> 76 <p> 77 The <span class="bold"><strong>flags</strong></span> parameter must be set to 0 78 or the following value: 79 </p> 80 <div class="itemizedlist"> 81 <ul type="disc"> 82 <li> 83 <p> 84 <code class="literal">DB_FORCE</code> 85 </p> 86 <p> 87 Force a checkpoint record, even if there has been no activity since 88 the last checkpoint. 89 </p> 90 </li> 91 </ul> 92 </div> 93 </div> 94 <div class="sect3" lang="en" xml:lang="en"> 95 <div class="titlepage"> 96 <div> 97 <div> 98 <h4 class="title"><a id="id1709109"></a>kbyte</h4> 99 </div> 100 </div> 101 </div> 102 <p> 103 If the <span class="bold"><strong>kbyte</strong></span> parameter is non-zero, a 104 checkpoint will be done if more than <span class="bold"><strong>kbyte</strong></span> kilobytes of log data have been written 105 since the last checkpoint. 106 </p> 107 </div> 108 <div class="sect3" lang="en" xml:lang="en"> 109 <div class="titlepage"> 110 <div> 111 <div> 112 <h4 class="title"><a id="id1709247"></a>min</h4> 113 </div> 114 </div> 115 </div> 116 <p> 117 If the <span class="bold"><strong>min</strong></span> parameter is non-zero, a 118 checkpoint will be done if more than <span class="bold"><strong>min</strong></span> minutes have passed since the last 119 checkpoint. 120 </p> 121 </div> 122 </div> 123 <div class="sect2" lang="en" xml:lang="en"> 124 <div class="titlepage"> 125 <div> 126 <div> 127 <h3 class="title"><a id="id1708723"></a>Errors</h3> 128 </div> 129 </div> 130 </div> 131 <p> 132 The <code class="methodname">DB_ENV->txn_checkpoint()</code> <span> 133 <span> 134 method may fail and return one of the following non-zero errors: 135 </span> 136 137 </span> 138 </p> 139 <div class="sect3" lang="en" xml:lang="en"> 140 <div class="titlepage"> 141 <div> 142 <div> 143 <h4 class="title"><a id="id1708465"></a>EINVAL</h4> 144 </div> 145 </div> 146 </div> 147 <p> 148 An invalid flag value or parameter was specified. 149 </p> 150 </div> 151 </div> 152 <div class="sect2" lang="en" xml:lang="en"> 153 <div class="titlepage"> 154 <div> 155 <div> 156 <h3 class="title"><a id="id1708466"></a>Class</h3> 157 </div> 158 </div> 159 </div> 160 <p> 161 <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a>, <a class="link" href="txn.html" title="Chapter 12. The DB_TXN Handle">DB_TXN</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="id1708582"></a>See Also</h3> 169 </div> 170 </div> 171 </div> 172 <p> 173 <a class="xref" href="txn.html#txnlist" title="Transaction Subsystem and Related Methods">Transaction 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="txnbegin.html">Prev</a> </td> 182 <td width="20%" align="center"> 183 <a accesskey="u" href="txn.html">Up</a> 184 </td> 185 <td width="40%" align="right"> <a accesskey="n" href="txncommit.html">Next</a></td> 186 </tr> 187 <tr> 188 <td width="40%" align="left" valign="top">DB_ENV->txn_begin() </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_TXN->commit()</td> 193 </tr> 194 </table> 195 </div> 196 </body> 197</html> 198