1<!--$Id: rep_timeout.so,v 1.12 2008/04/29 22:55:48 mbrey Exp $-->
2<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
3<!--See the file LICENSE for redistribution information.-->
4<html>
5<head>
6<title>Berkeley DB: DbEnv::rep_set_timeout</title>
7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
9</head>
10<body bgcolor=white>
11<table width="100%"><tr valign=top>
12<td>
13<b>DbEnv::rep_set_timeout</b>
14</td>
15<td align=right>
16<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a>
17<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
18</tr></table>
19<hr size=1 noshade>
20<tt>
21<b><pre>
22#include &lt;db_cxx.h&gt;
23<p>
24int
25DbEnv::rep_set_timeout(int which, u_int32_t timeout);
26<p>
27int
28DbEnv::rep_get_timeout(int which, u_int32_t *timeoutp);
29</pre></b>
30<hr size=1 noshade>
31<b>Description: DbEnv::rep_set_timeout</b>
32<p>The DbEnv::rep_set_timeout method specifies a variety of replication timeout
33values.</p>
34<p>The database environment's replication subsystem may also be configured using the
35environment's <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file.  The syntax of the entry in that
36file is a single line with the string "rep_set_timeout", one or more whitespace
37characters, and the <b>which</b> parameter specified as a string and the timeout
38specified as two parts.
39For example, "rep_set_timeout DB_REP_CONNECTION_RETRY 15000000"
40specifies the connection retry timeout for 15 seconds.
41Because the <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment
42is opened, it will silently overrule configuration done before that
43time.</p>
44<p>The DbEnv::rep_set_timeout method configures a database environment, not only operations
45performed using the specified <a href="../api_cxx/env_class.html">DbEnv</a> handle.</p>
46<p>The DbEnv::rep_set_timeout method may be called at any time during the life of the
47application.</p>
48<p>The DbEnv::rep_set_timeout method
49either returns a non-zero error value
50or throws an exception that encapsulates a non-zero error value on
51failure, and returns 0 on success.
52</p>
53<b>Parameters</b> <br>
54 <b>which</b><ul compact><li>The <b>which</b> parameter must be set to one of the following values:
55<br>
56<b><a name="DB_REP_ACK_TIMEOUT">DB_REP_ACK_TIMEOUT</a></b><ul compact><li>Configure the amount of time the replication manager's transport
57function waits to collect enough acknowledgments from replication group
58clients, before giving up and returning a failure indication.  The
59default wait time is 1 second.</ul>
60<b><a name="DB_REP_CHECKPOINT_DELAY">DB_REP_CHECKPOINT_DELAY</a></b><ul compact><li>Configure the amount of time a master site will delay between
61completing a checkpoint and writing a checkpoint record into the log.
62This delay allows clients to complete their own checkpoints before the
63master requires completion of them.  The default is 30 seconds.
64If all databases in the environment, and the environment's
65transaction log, are configured to reside in memory (never
66preserved to disk), then, although checkpoints are still
67necessary, the delay is not useful and should be set to 0.</ul>
68<b><a name="DB_REP_CONNECTION_RETRY">DB_REP_CONNECTION_RETRY</a></b><ul compact><li>Configure the amount of time the replication manager will wait before
69trying to re-establish a connection to another site after a communication
70failure.  The default wait time is 30 seconds.</ul>
71<b><a name="DB_REP_ELECTION_TIMEOUT">DB_REP_ELECTION_TIMEOUT</a></b><ul compact><li>The timeout period for an election.  The default timeout is 2 seconds.</ul>
72<b><a name="DB_REP_ELECTION_RETRY">DB_REP_ELECTION_RETRY</a></b><ul compact><li>Configure the amount of time the replication manager will wait before
73retrying a failed election.  The default wait time is 10 seconds.</ul>
74<b><a name="DB_REP_FULL_ELECTION_TIMEOUT">DB_REP_FULL_ELECTION_TIMEOUT</a></b><ul compact><li>An optional configuration timeout period to wait for full election
75participation the first time the replication group finds a master.
76By default this option is turned off and normal election
77timeouts are used.
78(See the <a href="../ref/rep/elect.html">Elections</a>
79section in the Berkeley DB Reference Guide for more information.)</ul>
80<b><a name="DB_REP_HEARTBEAT_MONITOR">DB_REP_HEARTBEAT_MONITOR</a></b><ul compact><li>The amount of time the replication manager, running at a client site,
81waits for some message activity on the connection from the master
82(heartbeats or other messages) before concluding that the connection
83has been lost.  When 0 (the default), no monitoring is performed.
84</ul>
85<b><a name="DB_REP_HEARTBEAT_SEND">DB_REP_HEARTBEAT_SEND</a></b><ul compact><li>The frequency at which the replication manager, running at a master site,
86broadcasts a heartbeat message in an otherwise idle system.  When 0
87(the default), no heartbeat messages will be sent.</ul>
88<b><a name="DB_REP_LEASE_TIMEOUT">DB_REP_LEASE_TIMEOUT</a></b><ul compact><li>Configure the amount of time a client grants its master lease
89to a master.  When using master leases all sites in a replication
90group must use the same lease timeout value.  There is no default
91value.  If leases are desired, this method must be called prior
92to calling <a href="../api_cxx/rep_start.html">DbEnv::rep_start</a> method.  See also <a href="../api_cxx/rep_clockskew.html">DbEnv::rep_set_clockskew</a> method,
93<a href="../api_cxx/rep_config.html">DbEnv::rep_set_config</a> method or
94<a href="../ref/rep/lease.html">Master leases</a>.</ul>
95<br>
96 <b>timeout</b><ul compact><li>The <b>timeout</b> parameter is the timeout value.  It must be specified
97as an unsigned 32-bit number of microseconds, limiting the maximum timeout
98to roughly 71 minutes.</ul></ul>
99<br>
100<br><b>Errors</b>
101<p>The DbEnv::rep_set_timeout method
102may fail and throw
103<a href="../api_cxx/except_class.html">DbException</a>,
104encapsulating one of the following non-zero errors, or return one of
105the following non-zero errors:</p>
106<br>
107<b>EINVAL</b><ul compact><li>An
108invalid flag value or parameter was specified.</ul>
109<br>
110<hr size=1 noshade>
111<b>Description: DbEnv::rep_get_timeout</b>
112<p>The DbEnv::rep_get_timeout method returns the timeout value for the specified
113<b>which</b> parameter.</p>
114<p>The DbEnv::rep_get_timeout method may be called at any time during the life of the
115application.</p>
116<p>The DbEnv::rep_get_timeout method
117either returns a non-zero error value
118or throws an exception that encapsulates a non-zero error value on
119failure, and returns 0 on success.
120</p>
121<b>Parameters</b> <br>
122 <b>which</b><ul compact><li>The <b>which</b> parameter is the timeout value for which the value
123is being returned.</ul>
124 <b>timeoutp</b><ul compact><li>The <b>timeoutp</b> parameter references memory into which
125 the timeout value of the specified <b>which</b> parameter is copied.</ul> The returned <b>timeout</b> value is in microseconds.
126<br>
127<hr size=1 noshade>
128<br><b>Class</b>
129<a href="../api_cxx/env_class.html">DbEnv</a>
130<br><b>See Also</b>
131<a href="../api_cxx/rep_list.html">Replication and Related Methods</a>
132</tt>
133<table width="100%"><tr><td><br></td><td align=right>
134<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
135</td></tr></table>
136<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
137</body>
138</html>
139