• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/db-4.8.30/docs/gsg_db_rep/JAVA/
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 class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">Managing Election Times</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="fwrkpermmessage.html">Prev</a>��</td>
22          <th width="60%" align="center">Chapter��3.��The DB Replication Manager</th>
23          <td width="20%" align="right">��<a accesskey="n" href="fmwrkconnectretry.html">Next</a></td>
24        </tr>
25      </table>
26      <hr />
27    </div>
28    <div class="sect1" lang="en" xml:lang="en">
29      <div class="titlepage">
30        <div>
31          <div>
32            <h2 class="title" style="clear: both"><a id="electiontimes"></a>Managing Election Times</h2>
33          </div>
34        </div>
35      </div>
36      <div class="toc">
37        <dl>
38          <dt>
39            <span class="sect2">
40              <a href="electiontimes.html#electiontimeout">Managing Election Timeouts</a>
41            </span>
42          </dt>
43          <dt>
44            <span class="sect2">
45              <a href="electiontimes.html#electretrytime">Managing Election Retry Times</a>
46            </span>
47          </dt>
48        </dl>
49      </div>
50      <p>
51                    Where it comes to elections, there are two timeout
52                    values with which you should be concerned: election
53                    timeouts and election retries.
54            </p>
55      <div class="sect2" lang="en" xml:lang="en">
56        <div class="titlepage">
57          <div>
58            <div>
59              <h3 class="title"><a id="electiontimeout"></a>Managing Election Timeouts</h3>
60            </div>
61          </div>
62        </div>
63        <p>
64                        When an environment calls for an election, it will wait
65                        some amount of time for the other replicas in the
66                        replication group to respond. The amount of time
67                        that the environment will wait before declaring the
68                        election completed is the <span class="emphasis"><em>election timeout</em></span>. 
69                    </p>
70        <p>
71                            If the environment hears from all other known replicas before 
72                            the election timeout occurs, the election is considered 
73                            a success and a master is elected.
74                    </p>
75        <p>
76                            If only a subset of replicas respond, then the success
77                            or failure of the election is determined by
78                            how many replicas have participated in the
79                            election. It only takes a simple
80                            majority of replicas to elect a master. If
81                            there are enough votes for a given environment to
82                            meet that standard, then the master has been
83                            elected and the election is considered a
84                            success.
85                    </p>
86        <p>
87                            However, if not enough replicas have participated in
88                            the election when the election timeout value is 
89                            reached, the election is considered a failure
90                            and a master is not elected. At this point,
91                            your replication group is operating without a
92                            master, which means that, essentially,
93                            your replicated application has been placed in
94                            read-only mode.
95                    </p>
96        <p>
97                            Note, however, that the Replication Manager will attempt a
98                            new election after a given amount of time has
99                            passed. See the next section for details.
100                    </p>
101        <p>
102                        You set the election timeout value using
103                        <code class="methodname">Environment.setReplicationTimeout()</code>.
104                        You pass this method the 
105                        <code class="methodname">ReplicationTimeoutType.ELECTION_TIMEOUT</code>
106                        constant and a timeout value in microseconds.
107                    </p>
108      </div>
109      <div class="sect2" lang="en" xml:lang="en">
110        <div class="titlepage">
111          <div>
112            <div>
113              <h3 class="title"><a id="electretrytime"></a>Managing Election Retry Times</h3>
114            </div>
115          </div>
116        </div>
117        <p>
118                            In the event that a election fails (see the
119                            previous section), an election will not be
120                            attempted again until the election retry
121                            timeout value has expired. 
122                    </p>
123        <p>
124                        You set the election timeout value using
125                        <code class="methodname">Environment.setReplicationTimeout()</code>.
126                        You pass this method the 
127                        <code class="methodname">ReplicationTimeoutType.ELECTION_RETRY</code>
128                        constant and a retry value in microseconds.
129                    </p>
130        <p>
131                        Note that this 
132                        <span>constant</span> is only
133                        valid when you are using the Replication Manager. If you are
134                        using the Base APIs, then this
135                        
136                        <span>constant</span> is
137                        ignored.
138                    </p>
139      </div>
140    </div>
141    <div class="navfooter">
142      <hr />
143      <table width="100%" summary="Navigation footer">
144        <tr>
145          <td width="40%" align="left"><a accesskey="p" href="fwrkpermmessage.html">Prev</a>��</td>
146          <td width="20%" align="center">
147            <a accesskey="u" href="repapp.html">Up</a>
148          </td>
149          <td width="40%" align="right">��<a accesskey="n" href="fmwrkconnectretry.html">Next</a></td>
150        </tr>
151        <tr>
152          <td width="40%" align="left" valign="top">Permanent Message Handling��</td>
153          <td width="20%" align="center">
154            <a accesskey="h" href="index.html">Home</a>
155          </td>
156          <td width="40%" align="right" valign="top">��Managing Connection Retries</td>
157        </tr>
158      </table>
159    </div>
160  </body>
161</html>
162