| 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::rep_set_timeout()</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 11. Replication Methods" /> |
| 11 | <link rel="prev" href="repset_request.html" title="DbEnv::rep_set_request()" /> |
| 12 | <link rel="next" href="reptransport.html" title="DbEnv::rep_set_transport()" /> |
| 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::rep_set_timeout()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="repset_request.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 11. |
| 26 | Replication Methods |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="reptransport.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="repset_timeout"></a>DbEnv::rep_set_timeout()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db_cxx.h> |
| 42 | |
| 43 | int |
| 44 | DbEnv::rep_set_timeout(int which, u_int32_t timeout); </pre> |
| 45 | <p> |
| 46 | The <code class="methodname">DbEnv::rep_set_timeout()</code> method |
| 47 | specifies a variety of replication timeout values. |
| 48 | </p> |
| 49 | <p> |
| 50 | The database environment's replication subsystem may also be |
| 51 | configured 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 |
| 52 | of the entry in that file is a single line with the string |
| 53 | "rep_set_timeout", one or more whitespace characters, and the |
| 54 | <span class="bold"><strong>which</strong></span> parameter specified as a |
| 55 | string and the timeout specified as two parts. For example, |
| 56 | "rep_set_timeout DB_REP_CONNECTION_RETRY 15000000" specifies the |
| 57 | connection retry timeout for 15 seconds. Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> |
| 58 | file is read when the database environment is opened, it will |
| 59 | silently overrule configuration done before that time. |
| 60 | </p> |
| 61 | <p> |
| 62 | The <code class="methodname">DbEnv::rep_set_timeout()</code> method |
| 63 | configures a database environment, not only operations performed |
| 64 | using the specified <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> |
| 65 | handle. |
| 66 | </p> |
| 67 | <p> |
| 68 | The <code class="methodname">DbEnv::rep_set_timeout()</code> method may not be |
| 69 | called to set the master lease timeout after the |
| 70 | <a class="xref" href="repmgrstart.html" title="DbEnv::repmgr_start()">DbEnv::repmgr_start()</a> method or the |
| 71 | <a class="xref" href="repstart.html" title="DbEnv::rep_start()">DbEnv::rep_start()</a> |
| 72 | method is called. For all other timeouts, the |
| 73 | <code class="methodname">DbEnv::rep_set_timeout()</code> |
| 74 | method may be called at any time during the life of the application. |
| 75 | </p> |
| 76 | <p> |
| 77 | The <code class="methodname">DbEnv::rep_set_timeout()</code> <span> |
| 78 | |
| 79 | <span> |
| 80 | method either returns a non-zero error value or throws an |
| 81 | exception that encapsulates a non-zero error value on |
| 82 | failure, and returns 0 on success. |
| 83 | </span> |
| 84 | </span> |
| 85 | </p> |
| 86 | <div class="sect2" lang="en" xml:lang="en"> |
| 87 | <div class="titlepage"> |
| 88 | <div> |
| 89 | <div> |
| 90 | <h3 class="title"><a id="idp9669688"></a>Parameters</h3> |
| 91 | </div> |
| 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="idp9669040"></a>timeout</h4> |
| 99 | </div> |
| 100 | </div> |
| 101 | </div> |
| 102 | <p> |
| 103 | The <span class="bold"><strong>timeout</strong></span> parameter is the timeout value. It |
| 104 | must be specified as an unsigned 32-bit number of microseconds, limiting the |
| 105 | maximum timeout to roughly 71 minutes. |
| 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="idp9606176"></a>which</h4> |
| 113 | </div> |
| 114 | </div> |
| 115 | </div> |
| 116 | <p> |
| 117 | The <span class="bold"><strong>which</strong></span> parameter must |
| 118 | be set to one of the following values: |
| 119 | </p> |
| 120 | <div class="itemizedlist"> |
| 121 | <ul type="disc"> |
| 122 | <li> |
| 123 | <p><a id="set_timeout_DB_REP_ACK_TIMEOUT"></a> |
| 124 | <code class="literal">DB_REP_ACK_TIMEOUT</code> |
| 125 | </p> |
| 126 | <p> |
| 127 | Configure the amount of time the Replication |
| 128 | Manager's transport function waits to collect |
| 129 | enough acknowledgments from replication group |
| 130 | clients, before giving up and returning a failure |
| 131 | indication. The default wait time is 1 second. |
| 132 | </p> |
| 133 | </li> |
| 134 | <li> |
| 135 | <p> |
| 136 | <code class="literal">DB_REP_CHECKPOINT_DELAY</code> |
| 137 | </p> |
| 138 | <p> |
| 139 | Configure the amount of time a master site will |
| 140 | delay between completing a checkpoint and writing |
| 141 | a checkpoint record into the log. This delay |
| 142 | allows clients to complete their own checkpoints |
| 143 | before the master requires completion of them. |
| 144 | The default is 30 seconds. If all databases in the |
| 145 | environment, and the environment's transaction |
| 146 | log, are configured to reside in memory (never |
| 147 | preserved to disk), then, although checkpoints are |
| 148 | still necessary, the delay is not useful and |
| 149 | should be set to 0. |
| 150 | </p> |
| 151 | </li> |
| 152 | <li> |
| 153 | <p> |
| 154 | <code class="literal">DB_REP_CONNECTION_RETRY</code> |
| 155 | </p> |
| 156 | <p> |
| 157 | Configure the amount of time the Replication |
| 158 | Manager will wait before trying to re-establish a |
| 159 | connection to another site after a communication |
| 160 | failure. The default wait time is 30 seconds. |
| 161 | </p> |
| 162 | </li> |
| 163 | <li> |
| 164 | <p> |
| 165 | <code class="literal">DB_REP_ELECTION_TIMEOUT</code> |
| 166 | </p> |
| 167 | <p> |
| 168 | The timeout period for an election. The default |
| 169 | timeout is 2 seconds. |
| 170 | </p> |
| 171 | </li> |
| 172 | <li> |
| 173 | <p> |
| 174 | <code class="literal">DB_REP_ELECTION_RETRY</code> |
| 175 | </p> |
| 176 | <p> |
| 177 | Configure the amount of time the Replication |
| 178 | Manager will wait before retrying a failed |
| 179 | election. The default wait time is 10 seconds. |
| 180 | </p> |
| 181 | </li> |
| 182 | <li> |
| 183 | <p><a id="set_timeout_DB_REP_FULL_ELECTION_TIMEOUT"></a> |
| 184 | <code class="literal">DB_REP_FULL_ELECTION_TIMEOUT</code> |
| 185 | </p> |
| 186 | <p> |
| 187 | An optional configuration timeout period to wait |
| 188 | for full election participation the first time the |
| 189 | replication group finds a master. By default this |
| 190 | option is turned off and normal election timeouts |
| 191 | are used. (See the |
| 192 | <a href="../../programmer_reference/rep_elect.html" class="olink">Elections</a> |
| 193 | section in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em> |
| 194 | for more information.) |
| 195 | </p> |
| 196 | </li> |
| 197 | <li> |
| 198 | <p> |
| 199 | <code class="literal">DB_REP_HEARTBEAT_MONITOR</code> |
| 200 | </p> |
| 201 | <p> |
| 202 | The amount of time the Replication Manager, |
| 203 | running at a client site, waits for some message |
| 204 | activity on the connection from the master |
| 205 | (heartbeats or other messages) before concluding |
| 206 | that the connection has been lost. This timeout |
| 207 | should be of longer duration than the |
| 208 | <code class="literal">DB_REP_HEARTBEAT_SEND</code> timeout |
| 209 | to ensure that heartbeats are not missed. When 0 |
| 210 | (the default), no monitoring is performed. |
| 211 | </p> |
| 212 | </li> |
| 213 | <li> |
| 214 | <p> |
| 215 | <code class="literal">DB_REP_HEARTBEAT_SEND</code> |
| 216 | </p> |
| 217 | <p> |
| 218 | The frequency at which the Replication Manager, |
| 219 | running at a master site, broadcasts a heartbeat |
| 220 | message in an otherwise idle system. Heartbeat |
| 221 | messages are used at client sites to monitor the |
| 222 | connection to the master and to help request missing |
| 223 | master changes in the absence of master activity. |
| 224 | When 0 (the default), no heartbeat messages will be |
| 225 | sent. |
| 226 | </p> |
| 227 | </li> |
| 228 | <li> |
| 229 | <p> |
| 230 | <code class="literal">DB_REP_LEASE_TIMEOUT</code> |
| 231 | </p> |
| 232 | <p> |
| 233 | Configure the amount of time a client grants its |
| 234 | master lease to a master. When using master |
| 235 | leases all sites in a replication group must use |
| 236 | the same lease timeout value. There is no default |
| 237 | value. If leases are desired, this method must be |
| 238 | called prior to calling |
| 239 | <a class="xref" href="repstart.html" title="DbEnv::rep_start()">DbEnv::rep_start()</a> method. |
| 240 | See also <a class="xref" href="repclockskew.html" title="DbEnv::rep_set_clockskew()">DbEnv::rep_set_clockskew()</a> |
| 241 | method, <a class="xref" href="repconfig.html" title="DbEnv::rep_set_config()">DbEnv::rep_set_config()</a> |
| 242 | method or <a href="../../programmer_reference/rep_lease.html" class="olink">Master leases</a>. |
| 243 | </p> |
| 244 | </li> |
| 245 | </ul> |
| 246 | </div> |
| 247 | </div> |
| 248 | </div> |
| 249 | <div class="sect2" lang="en" xml:lang="en"> |
| 250 | <div class="titlepage"> |
| 251 | <div> |
| 252 | <div> |
| 253 | <h3 class="title"><a id="idp9688120"></a>Errors</h3> |
| 254 | </div> |
| 255 | </div> |
| 256 | </div> |
| 257 | <p> |
| 258 | The <code class="methodname">DbEnv::rep_set_timeout()</code> <span> |
| 259 | |
| 260 | <span> |
| 261 | method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> |
| 262 | exception, encapsulating one of the following non-zero errors, or return one |
| 263 | of the following non-zero errors: |
| 264 | </span> |
| 265 | </span> |
| 266 | </p> |
| 267 | <div class="sect3" lang="en" xml:lang="en"> |
| 268 | <div class="titlepage"> |
| 269 | <div> |
| 270 | <div> |
| 271 | <h4 class="title"><a id="idp9685312"></a>EINVAL</h4> |
| 272 | </div> |
| 273 | </div> |
| 274 | </div> |
| 275 | <p> |
| 276 | If setting the lease timeout and replication has already been started; if |
| 277 | setting a Replication Manager timeout for a Base API application; |
| 278 | or if an invalid flag value or parameter was specified. |
| 279 | </p> |
| 280 | </div> |
| 281 | </div> |
| 282 | <div class="sect2" lang="en" xml:lang="en"> |
| 283 | <div class="titlepage"> |
| 284 | <div> |
| 285 | <div> |
| 286 | <h3 class="title"><a id="idp9681824"></a>Class</h3> |
| 287 | </div> |
| 288 | </div> |
| 289 | </div> |
| 290 | <p> |
| 291 | <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> |
| 292 | </p> |
| 293 | </div> |
| 294 | <div class="sect2" lang="en" xml:lang="en"> |
| 295 | <div class="titlepage"> |
| 296 | <div> |
| 297 | <div> |
| 298 | <h3 class="title"><a id="idp9698800"></a>See Also</h3> |
| 299 | </div> |
| 300 | </div> |
| 301 | </div> |
| 302 | <p> |
| 303 | <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a> |
| 304 | </p> |
| 305 | </div> |
| 306 | </div> |
| 307 | <div class="navfooter"> |
| 308 | <hr /> |
| 309 | <table width="100%" summary="Navigation footer"> |
| 310 | <tr> |
| 311 | <td width="40%" align="left"><a accesskey="p" href="repset_request.html">Prev</a> </td> |
| 312 | <td width="20%" align="center"> |
| 313 | <a accesskey="u" href="rep.html">Up</a> |
| 314 | </td> |
| 315 | <td width="40%" align="right"> <a accesskey="n" href="reptransport.html">Next</a></td> |
| 316 | </tr> |
| 317 | <tr> |
| 318 | <td width="40%" align="left" valign="top">DbEnv::rep_set_request() </td> |
| 319 | <td width="20%" align="center"> |
| 320 | <a accesskey="h" href="index.html">Home</a> |
| 321 | </td> |
| 322 | <td width="40%" align="right" valign="top"> DbEnv::rep_set_transport()</td> |
| 323 | </tr> |
| 324 | </table> |
| 325 | </div> |
| 326 | </body> |
| 327 | </html> |