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">
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <title>Managing Election Times</title>
7 <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9 <link rel="start" href="index.html" title="Getting Started with Replicated Berkeley DB Applications" />
10 <link rel="up" href="repapp.html" title="Chapter 3. The DB Replication Manager" />
11 <link rel="prev" href="fwrkpermmessage.html" title="Permanent Message Handling" />
12 <link rel="next" href="fmwrkconnectretry.html" title="Managing Connection Retries" />
15 <div xmlns="" class="navheader">
17 <p>Library Version 11.2.5.3</p>
19 <table width="100%" summary="Navigation header">
21 <th colspan="3" align="center">Managing Election Times</th>
24 <td width="20%" align="left"><a accesskey="p" href="fwrkpermmessage.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 3. The DB Replication Manager</th>
26 <td width="20%" align="right"> <a accesskey="n" href="fmwrkconnectretry.html">Next</a></td>
31 <div class="sect1" lang="en" xml:lang="en">
32 <div class="titlepage">
35 <h2 class="title" style="clear: both"><a id="electiontimes"></a>Managing Election Times</h2>
43 <a href="electiontimes.html#electiontimeout">Managing Election Timeouts</a>
48 <a href="electiontimes.html#electretrytime">Managing Election Retry Times</a>
54 Where it comes to elections, there are two timeout
55 values with which you should be concerned: election
56 timeouts and election retries.
58 <div class="sect2" lang="en" xml:lang="en">
59 <div class="titlepage">
62 <h3 class="title"><a id="electiontimeout"></a>Managing Election Timeouts</h3>
67 When an environment calls for an election, it will wait
68 some amount of time for the other replicas in the
69 replication group to respond. The amount of time
70 that the environment will wait before declaring the
71 election completed is the <span class="emphasis"><em>election timeout</em></span>.
74 If the environment hears from all other known replicas before
75 the election timeout occurs, the election is considered
76 a success and a master is elected.
79 If only a subset of replicas respond, then the success
80 or failure of the election is determined by
81 how many replicas have participated in the
82 election. It only takes a simple
83 majority of replicas to elect a master. If
84 there are enough votes for a given environment to
85 meet that standard, then the master has been
86 elected and the election is considered a
90 However, if not enough replicas have participated in
91 the election when the election timeout value is
92 reached, the election is considered a failure
93 and a master is not elected. At this point,
94 your replication group is operating without a
95 master, which means that, essentially,
96 your replicated application has been placed in
100 Note, however, that the Replication Manager will attempt a
101 new election after a given amount of time has
102 passed. See the next section for details.
105 You set the election timeout value using
106 <span><code class="methodname">DB_ENV->rep_set_timeout()</code>.</span>
108 To do so, specify the
109 <code class="literal">DB_REP_ELECTION_TIMEOUT</code>
110 value to the <code class="literal">which</code> parameter and then a
111 timeout value in microseconds to the
112 <code class="literal">timeout</code> parameter.
115 <div class="sect2" lang="en" xml:lang="en">
116 <div class="titlepage">
119 <h3 class="title"><a id="electretrytime"></a>Managing Election Retry Times</h3>
124 In the event that a election fails (see the
125 previous section), an election will not be
126 attempted again until the election retry
127 timeout value has expired.
130 You set the retry timeout value using
131 <span><code class="methodname">DB_ENV->rep_set_timeout()</code>.</span>
133 To do so, specify the
134 <code class="literal">DB_REP_ELECTION_RETRY</code>
135 value to the <code class="literal">which</code> parameter and then a
136 retry value in microseconds to the
137 <code class="literal">timeout</code> parameter.
140 Note that this <span>flag</span>
142 valid when you are using the Replication Manager. If you are
143 using the Base APIs, then this
150 <div class="navfooter">
152 <table width="100%" summary="Navigation footer">
154 <td width="40%" align="left"><a accesskey="p" href="fwrkpermmessage.html">Prev</a> </td>
155 <td width="20%" align="center">
156 <a accesskey="u" href="repapp.html">Up</a>
158 <td width="40%" align="right"> <a accesskey="n" href="fmwrkconnectretry.html">Next</a></td>
161 <td width="40%" align="left" valign="top">Permanent Message Handling </td>
162 <td width="20%" align="center">
163 <a accesskey="h" href="index.html">Home</a>
165 <td width="40%" align="right" valign="top"> Managing Connection Retries</td>