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