| 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_applied()</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="rep.html" title="Chapter 10. Replication Methods" /> |
| 11 | <link rel="prev" href="repmgrstat_print.html" title="DB_ENV->repmgr_stat_print()" /> |
| 12 | <link rel="next" href="txnset_commit_token.html" title="DB_TXN->set_commit_token()" /> |
| 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->txn_applied()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="repmgrstat_print.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 10. |
| 26 | Replication Methods |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="txnset_commit_token.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="envtxn_applied"></a>DB_ENV->txn_applied()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db.h> |
| 42 | |
| 43 | int |
| 44 | DB_ENV->txn_applied(DB_ENV *env, DB_TXN_TOKEN *token, |
| 45 | db_timeout_t timeout, u_int32_t flags); </pre> |
| 46 | <p> |
| 47 | The <code class="methodname">DB_ENV->txn_applied()</code> method checks to |
| 48 | see if a specified transaction has been replicated from the master |
| 49 | of a replication group. It may be called by applications using |
| 50 | either the Base API or the Replication Manager. |
| 51 | </p> |
| 52 | <p> |
| 53 | If the transaction has not yet arrived, this method will block for |
| 54 | the amount of time specified on the <code class="literal">timeout</code> |
| 55 | parameter while it waits for the result to be determined. For more |
| 56 | information, please refer to the |
| 57 | <a href="../../programmer_reference/rep_ryw.html" class="olink">Read your writes consistency</a> |
| 58 | section in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>. |
| 59 | </p> |
| 60 | <p> |
| 61 | The <code class="methodname">DB_ENV->txn_applied()</code> method may not be |
| 62 | called before the <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> |
| 63 | method. |
| 64 | </p> |
| 65 | <p> |
| 66 | The <code class="methodname">DB_ENV->txn_applied()</code> method returns a |
| 67 | non-zero error on failure and 0 to indicate that the specified |
| 68 | transaction has been applied at the local site. It may also return |
| 69 | one of the following non-zero return codes: |
| 70 | </p> |
| 71 | <div class="itemizedlist"> |
| 72 | <ul type="disc"> |
| 73 | <li> |
| 74 | <p> |
| 75 | <code class="literal">DB_TIMEOUT</code> |
| 76 | </p> |
| 77 | <p> |
| 78 | Returned if the specified transaction has not yet arrived |
| 79 | at the calling site, but can be expected to arrive soon. |
| 80 | If a non-zero timeout parameter is given, the this method |
| 81 | always waits for the specified amount of time before |
| 82 | returning <code class="literal">DB_TIMEOUT</code>. |
| 83 | </p> |
| 84 | </li> |
| 85 | <li> |
| 86 | <p> |
| 87 | <code class="literal">DB_NOTFOUND</code> |
| 88 | </p> |
| 89 | <p> |
| 90 | Returned if the transaction is expected to never arrive. |
| 91 | This occurs if the transaction has not been applied at the |
| 92 | local site because the transaction has been rolled back due |
| 93 | to a master takeover. |
| 94 | </p> |
| 95 | </li> |
| 96 | </ul> |
| 97 | </div> |
| 98 | <div class="sect2" lang="en" xml:lang="en"> |
| 99 | <div class="titlepage"> |
| 100 | <div> |
| 101 | <div> |
| 102 | <h3 class="title"><a id="idp54493696"></a>Parameters</h3> |
| 103 | </div> |
| 104 | </div> |
| 105 | </div> |
| 106 | <div class="sect3" lang="en" xml:lang="en"> |
| 107 | <div class="titlepage"> |
| 108 | <div> |
| 109 | <div> |
| 110 | <h4 class="title"><a id="idp54513840"></a>flags</h4> |
| 111 | </div> |
| 112 | </div> |
| 113 | </div> |
| 114 | <p> |
| 115 | The <span class="bold"><strong>flags</strong></span> parameter is |
| 116 | currently unused, and must be set to 0. |
| 117 | </p> |
| 118 | </div> |
| 119 | <div class="sect3" lang="en" xml:lang="en"> |
| 120 | <div class="titlepage"> |
| 121 | <div> |
| 122 | <div> |
| 123 | <h4 class="title"><a id="idp54530664"></a>token</h4> |
| 124 | </div> |
| 125 | </div> |
| 126 | </div> |
| 127 | <p> |
| 128 | A pointer to a buffer containing a copy of a commit token |
| 129 | previously generated at the replication group's master |
| 130 | environment. Commit tokens are created using the |
| 131 | <a class="xref" href="txnset_commit_token.html" title="DB_TXN->set_commit_token()">DB_TXN->set_commit_token()</a> |
| 132 | method. |
| 133 | </p> |
| 134 | </div> |
| 135 | <div class="sect3" lang="en" xml:lang="en"> |
| 136 | <div class="titlepage"> |
| 137 | <div> |
| 138 | <div> |
| 139 | <h4 class="title"><a id="idp54536584"></a>timeout</h4> |
| 140 | </div> |
| 141 | </div> |
| 142 | </div> |
| 143 | <p> |
| 144 | Specifies the maximum time to wait for the transaction to |
| 145 | arrive by replication, expressed in microseconds. |
| 146 | To check the status of the transaction |
| 147 | without waiting, provide a timeout value of 0. |
| 148 | </p> |
| 149 | </div> |
| 150 | </div> |
| 151 | <div class="sect2" lang="en" xml:lang="en"> |
| 152 | <div class="titlepage"> |
| 153 | <div> |
| 154 | <div> |
| 155 | <h3 class="title"><a id="idp54531008"></a>Errors</h3> |
| 156 | </div> |
| 157 | </div> |
| 158 | </div> |
| 159 | <p> |
| 160 | The <code class="methodname">DB_ENV->txn_applied()</code> <span> |
| 161 | <span> |
| 162 | method may fail and return one of the following non-zero errors: |
| 163 | </span> |
| 164 | |
| 165 | </span> |
| 166 | </p> |
| 167 | <div class="sect3" lang="en" xml:lang="en"> |
| 168 | <div class="titlepage"> |
| 169 | <div> |
| 170 | <div> |
| 171 | <h4 class="title"><a id="idp54495608"></a>DB_KEYEMPTY</h4> |
| 172 | </div> |
| 173 | </div> |
| 174 | </div> |
| 175 | <p> |
| 176 | The specified token was generated by a transaction that did |
| 177 | not modify the database environment (for example, a read-only |
| 178 | transaction). |
| 179 | </p> |
| 180 | </div> |
| 181 | <div class="sect3" lang="en" xml:lang="en"> |
| 182 | <div class="titlepage"> |
| 183 | <div> |
| 184 | <div> |
| 185 | <h4 class="title"><a id="idp54545840"></a> DB_LOCK_DEADLOCK</h4> |
| 186 | </div> |
| 187 | </div> |
| 188 | </div> |
| 189 | <p> |
| 190 | While waiting for the result to be determined, the API |
| 191 | became locked out due to replication role change and/or |
| 192 | master/client synchronization. The application should |
| 193 | abort in-flight transactions, pause briefly, and then |
| 194 | retry. |
| 195 | </p> |
| 196 | </div> |
| 197 | <div class="sect3" lang="en" xml:lang="en"> |
| 198 | <div class="titlepage"> |
| 199 | <div> |
| 200 | <div> |
| 201 | <h4 class="title"><a id="idp54546488"></a>EINVAL</h4> |
| 202 | </div> |
| 203 | </div> |
| 204 | </div> |
| 205 | <p> |
| 206 | If the specified token was generated from a non-replicated |
| 207 | database environment. |
| 208 | </p> |
| 209 | </div> |
| 210 | </div> |
| 211 | <div class="sect2" lang="en" xml:lang="en"> |
| 212 | <div class="titlepage"> |
| 213 | <div> |
| 214 | <div> |
| 215 | <h3 class="title"><a id="idp54528720"></a>Class</h3> |
| 216 | </div> |
| 217 | </div> |
| 218 | </div> |
| 219 | <p> |
| 220 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> |
| 221 | </p> |
| 222 | </div> |
| 223 | <div class="sect2" lang="en" xml:lang="en"> |
| 224 | <div class="titlepage"> |
| 225 | <div> |
| 226 | <div> |
| 227 | <h3 class="title"><a id="idp54531720"></a>See Also</h3> |
| 228 | </div> |
| 229 | </div> |
| 230 | </div> |
| 231 | <p> |
| 232 | <a class="xref" href="txn.html#txnlist" title="Transaction Subsystem and Related Methods">Transaction Subsystem and Related Methods</a>, |
| 233 | <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a> |
| 234 | </p> |
| 235 | </div> |
| 236 | </div> |
| 237 | <div class="navfooter"> |
| 238 | <hr /> |
| 239 | <table width="100%" summary="Navigation footer"> |
| 240 | <tr> |
| 241 | <td width="40%" align="left"><a accesskey="p" href="repmgrstat_print.html">Prev</a> </td> |
| 242 | <td width="20%" align="center"> |
| 243 | <a accesskey="u" href="rep.html">Up</a> |
| 244 | </td> |
| 245 | <td width="40%" align="right"> <a accesskey="n" href="txnset_commit_token.html">Next</a></td> |
| 246 | </tr> |
| 247 | <tr> |
| 248 | <td width="40%" align="left" valign="top">DB_ENV->repmgr_stat_print() </td> |
| 249 | <td width="20%" align="center"> |
| 250 | <a accesskey="h" href="index.html">Home</a> |
| 251 | </td> |
| 252 | <td width="40%" align="right" valign="top"> DB_TXN->set_commit_token()</td> |
| 253 | </tr> |
| 254 | </table> |
| 255 | </div> |
| 256 | </body> |
| 257 | </html> |