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