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