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 <span><code class="methodname">DB_ENV->rep_set_timeout()</code>.</span> 104 105 To do so, specify the 106 <code class="literal">DB_REP_ELECTION_TIMEOUT</code> 107 value to the <code class="literal">which</code> parameter and then a 108 timeout value in microseconds to the 109 <code class="literal">timeout</code> parameter. 110 </p> 111 </div> 112 <div class="sect2" lang="en" xml:lang="en"> 113 <div class="titlepage"> 114 <div> 115 <div> 116 <h3 class="title"><a id="electretrytime"></a>Managing Election Retry Times</h3> 117 </div> 118 </div> 119 </div> 120 <p> 121 In the event that a election fails (see the 122 previous section), an election will not be 123 attempted again until the election retry 124 timeout value has expired. 125 </p> 126 <p> 127 You set the retry timeout value using 128 <span><code class="methodname">DB_ENV->rep_set_timeout()</code>.</span> 129 130 To do so, specify the 131 <code class="literal">DB_REP_ELECTION_RETRY</code> 132 value to the <code class="literal">which</code> parameter and then a 133 retry value in microseconds to the 134 <code class="literal">timeout</code> parameter. 135 </p> 136 <p> 137 Note that this <span>flag</span> 138 is only 139 valid when you are using the Replication Manager. If you are 140 using the Base APIs, then this 141 <span>flag</span> 142 is 143 ignored. 144 </p> 145 </div> 146 </div> 147 <div class="navfooter"> 148 <hr /> 149 <table width="100%" summary="Navigation footer"> 150 <tr> 151 <td width="40%" align="left"><a accesskey="p" href="fwrkpermmessage.html">Prev</a>��</td> 152 <td width="20%" align="center"> 153 <a accesskey="u" href="repapp.html">Up</a> 154 </td> 155 <td width="40%" align="right">��<a accesskey="n" href="fmwrkconnectretry.html">Next</a></td> 156 </tr> 157 <tr> 158 <td width="40%" align="left" valign="top">Permanent Message Handling��</td> 159 <td width="20%" align="center"> 160 <a accesskey="h" href="index.html">Home</a> 161 </td> 162 <td width="40%" align="right" valign="top">��Managing Connection Retries</td> 163 </tr> 164 </table> 165 </div> 166 </body> 167</html> 168