Imported Upstream version 5.3.21
[platform/upstream/libdb.git] / docs / gsg_db_rep / C / electiontimes.html
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>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" />
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">Managing Election Times</th>
22         </tr>
23         <tr>
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>
27         </tr>
28       </table>
29       <hr />
30     </div>
31     <div class="sect1" lang="en" xml:lang="en">
32       <div class="titlepage">
33         <div>
34           <div>
35             <h2 class="title" style="clear: both"><a id="electiontimes"></a>Managing Election Times</h2>
36           </div>
37         </div>
38       </div>
39       <div class="toc">
40         <dl>
41           <dt>
42             <span class="sect2">
43               <a href="electiontimes.html#electiontimeout">Managing Election Timeouts</a>
44             </span>
45           </dt>
46           <dt>
47             <span class="sect2">
48               <a href="electiontimes.html#electretrytime">Managing Election Retry Times</a>
49             </span>
50           </dt>
51         </dl>
52       </div>
53       <p>
54                     Where it comes to elections, there are two timeout
55                     values with which you should be concerned: election
56                     timeouts and election retries.
57             </p>
58       <div class="sect2" lang="en" xml:lang="en">
59         <div class="titlepage">
60           <div>
61             <div>
62               <h3 class="title"><a id="electiontimeout"></a>Managing Election Timeouts</h3>
63             </div>
64           </div>
65         </div>
66         <p>
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>. 
72                     </p>
73         <p>
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.
77                     </p>
78         <p>
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
87                             success.
88                     </p>
89         <p>
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
97                             read-only mode.
98                     </p>
99         <p>
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.
103                     </p>
104         <p>
105                             You set the election timeout value using
106                             <span><code class="methodname">DB_ENV-&gt;rep_set_timeout()</code>.</span>
107                             
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.
113                     </p>
114       </div>
115       <div class="sect2" lang="en" xml:lang="en">
116         <div class="titlepage">
117           <div>
118             <div>
119               <h3 class="title"><a id="electretrytime"></a>Managing Election Retry Times</h3>
120             </div>
121           </div>
122         </div>
123         <p>
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. 
128                     </p>
129         <p>
130                             You set the retry timeout value using
131                             <span><code class="methodname">DB_ENV-&gt;rep_set_timeout()</code>.</span>
132                             
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.
138                     </p>
139         <p>
140                         Note that this <span>flag</span>
141                          is only
142                         valid when you are using the Replication Manager. If you are
143                         using the Base APIs, then this
144                         <span>flag</span>
145                          is
146                         ignored.
147                     </p>
148       </div>
149     </div>
150     <div class="navfooter">
151       <hr />
152       <table width="100%" summary="Navigation footer">
153         <tr>
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>
157           </td>
158           <td width="40%" align="right"> <a accesskey="n" href="fmwrkconnectretry.html">Next</a></td>
159         </tr>
160         <tr>
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>
164           </td>
165           <td width="40%" align="right" valign="top"> Managing Connection Retries</td>
166         </tr>
167       </table>
168     </div>
169   </body>
170 </html>