| 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>DB_ENV->rep_set_priority()</title> |
| 7 | <link rel="stylesheet" href="apiReference.css" type="text/css" /> |
| 8 | <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> |
| 9 | <link rel="start" href="index.html" title="Berkeley DB C API Reference" /> |
| 10 | <link rel="up" href="rep.html" title="Chapter 10. Replication Methods" /> |
| 11 | <link rel="prev" href="repnsites.html" title="DB_ENV->rep_set_nsites()" /> |
| 12 | <link rel="next" href="repset_request.html" title="DB_ENV->rep_set_request()" /> |
| 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">DB_ENV->rep_set_priority()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="repnsites.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 10. |
| 26 | Replication Methods |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="repset_request.html">Next</a></td> |
| 29 | </tr> |
| 30 | </table> |
| 31 | <hr /> |
| 32 | </div> |
| 33 | <div class="sect1" lang="en" xml:lang="en"> |
| 34 | <div class="titlepage"> |
| 35 | <div> |
| 36 | <div> |
| 37 | <h2 class="title" style="clear: both"><a id="reppriority"></a>DB_ENV->rep_set_priority()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db.h> |
| 42 | |
| 43 | int |
| 44 | DB_ENV->rep_set_priority(DB_ENV *env, u_int32_t priority); </pre> |
| 45 | <p> |
| 46 | The <code class="methodname">DB_ENV->rep_set_priority()</code> method specifies the database |
| 47 | environment's priority in replication group elections. A special |
| 48 | value of 0 indicates that this environment cannot be a replication |
| 49 | group master. |
| 50 | </p> |
| 51 | <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> |
| 52 | <h3 class="title">Note</h3> |
| 53 | <p> |
| 54 | The |
| 55 | <a class="xref" href="repmgrset_ack_policy.html" title="DB_ENV->repmgr_set_ack_policy()">DB_ENV->repmgr_set_ack_policy()</a> |
| 56 | method describes <span class="emphasis"><em>electable peers</em></span>, which |
| 57 | are replication sites with a non-zero priority. For some |
| 58 | acknowledgement policies, Replication Manager's computation of |
| 59 | the durability result for each new update transaction is |
| 60 | sensitive to whether each site in the group is a peer. |
| 61 | Therefore, if you change a site's priority from a non-zero |
| 62 | value to <code class="literal">0</code>, or from <code class="literal">0</code> to |
| 63 | a non-zero value, this can invalidate the durability result of |
| 64 | previously committed transactions. |
| 65 | </p> |
| 66 | </div> |
| 67 | <p> |
| 68 | The database environment's replication subsystem may also be |
| 69 | configured using the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. The syntax |
| 70 | of the entry in that file is a single line with the string |
| 71 | "rep_set_priority", one or more whitespace characters, and the |
| 72 | priority of this site. For example, "rep_set_priority 1" sets the |
| 73 | priority of this site to 1. Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is read |
| 74 | when the database environment is opened, it will silently overrule |
| 75 | configuration done before that time. |
| 76 | </p> |
| 77 | <p> |
| 78 | Note that if the application never explicitly sets a priority, then a default value of 100 |
| 79 | is used. |
| 80 | </p> |
| 81 | <p> |
| 82 | The <code class="methodname">DB_ENV->rep_set_priority()</code> method configures a database |
| 83 | environment, not only operations performed using the specified |
| 84 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handle. |
| 85 | </p> |
| 86 | <p> |
| 87 | The <code class="methodname">DB_ENV->rep_set_priority()</code> method may be called at any time |
| 88 | during the life of the application. |
| 89 | </p> |
| 90 | <p> |
| 91 | The <code class="methodname">DB_ENV->rep_set_priority()</code> <span> |
| 92 | <span> |
| 93 | method returns a non-zero error value on failure and 0 on success. |
| 94 | </span> |
| 95 | |
| 96 | </span> |
| 97 | </p> |
| 98 | <div class="sect2" lang="en" xml:lang="en"> |
| 99 | <div class="titlepage"> |
| 100 | <div> |
| 101 | <div> |
| 102 | <h3 class="title"><a id="idp54164408"></a>Parameters</h3> |
| 103 | </div> |
| 104 | </div> |
| 105 | </div> |
| 106 | <div class="sect3" lang="en" xml:lang="en"> |
| 107 | <div class="titlepage"> |
| 108 | <div> |
| 109 | <div> |
| 110 | <h4 class="title"><a id="idp54163760"></a>priority</h4> |
| 111 | </div> |
| 112 | </div> |
| 113 | </div> |
| 114 | <p> |
| 115 | The priority of this database environment in the replication group. The |
| 116 | priority must be a non-zero integer, or 0 if this environment cannot be a |
| 117 | replication group master. (See |
| 118 | <a href="../../programmer_reference/rep_pri.html" class="olink">Replication environment priorities</a> |
| 119 | for more information). |
| 120 | </p> |
| 121 | </div> |
| 122 | </div> |
| 123 | <div class="sect2" lang="en" xml:lang="en"> |
| 124 | <div class="titlepage"> |
| 125 | <div> |
| 126 | <div> |
| 127 | <h3 class="title"><a id="idp54132032"></a>Class</h3> |
| 128 | </div> |
| 129 | </div> |
| 130 | </div> |
| 131 | <p> |
| 132 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> |
| 133 | </p> |
| 134 | </div> |
| 135 | <div class="sect2" lang="en" xml:lang="en"> |
| 136 | <div class="titlepage"> |
| 137 | <div> |
| 138 | <div> |
| 139 | <h3 class="title"><a id="idp54122592"></a>See Also</h3> |
| 140 | </div> |
| 141 | </div> |
| 142 | </div> |
| 143 | <p> |
| 144 | <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a> |
| 145 | </p> |
| 146 | </div> |
| 147 | </div> |
| 148 | <div class="navfooter"> |
| 149 | <hr /> |
| 150 | <table width="100%" summary="Navigation footer"> |
| 151 | <tr> |
| 152 | <td width="40%" align="left"><a accesskey="p" href="repnsites.html">Prev</a> </td> |
| 153 | <td width="20%" align="center"> |
| 154 | <a accesskey="u" href="rep.html">Up</a> |
| 155 | </td> |
| 156 | <td width="40%" align="right"> <a accesskey="n" href="repset_request.html">Next</a></td> |
| 157 | </tr> |
| 158 | <tr> |
| 159 | <td width="40%" align="left" valign="top">DB_ENV->rep_set_nsites() </td> |
| 160 | <td width="20%" align="center"> |
| 161 | <a accesskey="h" href="index.html">Home</a> |
| 162 | </td> |
| 163 | <td width="40%" align="right" valign="top"> DB_ENV->rep_set_request()</td> |
| 164 | </tr> |
| 165 | </table> |
| 166 | </div> |
| 167 | </body> |
| 168 | </html> |