| 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>DbEnv::rep_set_nsites()</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 11. Replication Methods" /> |
| 11 | <link rel="prev" href="repset_limit.html" title="DbEnv::rep_set_limit()" /> |
| 12 | <link rel="next" href="reppriority.html" title="DbEnv::rep_set_priority()" /> |
| 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">DbEnv::rep_set_nsites()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="repset_limit.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 11. |
| 26 | Replication Methods |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="reppriority.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="repnsites"></a>DbEnv::rep_set_nsites()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db_cxx.h> |
| 42 | |
| 43 | int |
| 44 | DbEnv::rep_set_nsites(u_int32_t nsites); </pre> |
| 45 | <p> |
| 46 | The <code class="methodname">DbEnv::rep_set_nsites()</code> method specifies the total number of |
| 47 | sites in a replication group. This method should not be used by |
| 48 | Replication Manager applications; the number of sites in use by a |
| 49 | Replication Manager application is determined dynamically. |
| 50 | </p> |
| 51 | <p> |
| 52 | The <code class="methodname">DbEnv::rep_set_nsites()</code> method is typically called by |
| 53 | Base API applications. (However, see also the |
| 54 | <a class="xref" href="repelect.html" title="DbEnv::rep_elect()">DbEnv::rep_elect()</a> method |
| 55 | <span class="bold"><strong>nsites</strong></span> |
| 56 | parameter.) |
| 57 | </p> |
| 58 | <p> |
| 59 | The database environment's replication subsystem may also be |
| 60 | 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 of |
| 61 | the entry in that file is a single line with the string |
| 62 | "rep_set_nsites", one or more whitespace characters, and the |
| 63 | number of sites specified. For example, "rep_set_nsites 5" sets |
| 64 | the number of sites to 5. Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is read |
| 65 | when the database environment is opened, it will silently overrule |
| 66 | configuration done before that time. |
| 67 | </p> |
| 68 | <p> |
| 69 | The <code class="methodname">DbEnv::rep_set_nsites()</code> method configures a database |
| 70 | environment, not only operations performed using the specified |
| 71 | <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> handle. |
| 72 | </p> |
| 73 | <p> |
| 74 | If master leases are in use, the <code class="methodname">DbEnv::rep_set_nsites()</code> method |
| 75 | should not be called after the <a class="xref" href="repstart.html" title="DbEnv::rep_start()">DbEnv::rep_start()</a> |
| 76 | method is called as this could cause you to lose data previously |
| 77 | thought to be durable. If master leases are not in use, the |
| 78 | <code class="methodname">DbEnv::rep_set_nsites()</code> method may be |
| 79 | called at any time during the life of the application. |
| 80 | </p> |
| 81 | <p> |
| 82 | The <code class="methodname">DbEnv::rep_set_nsites()</code> <span> |
| 83 | |
| 84 | <span> |
| 85 | method either returns a non-zero error value or throws an |
| 86 | exception that encapsulates a non-zero error value on |
| 87 | failure, and returns 0 on success. |
| 88 | </span> |
| 89 | </span> |
| 90 | </p> |
| 91 | <div class="sect2" lang="en" xml:lang="en"> |
| 92 | <div class="titlepage"> |
| 93 | <div> |
| 94 | <div> |
| 95 | <h3 class="title"><a id="idp9626936"></a>Parameters</h3> |
| 96 | </div> |
| 97 | </div> |
| 98 | </div> |
| 99 | <div class="sect3" lang="en" xml:lang="en"> |
| 100 | <div class="titlepage"> |
| 101 | <div> |
| 102 | <div> |
| 103 | <h4 class="title"><a id="idp9626032"></a>nsites</h4> |
| 104 | </div> |
| 105 | </div> |
| 106 | </div> |
| 107 | <p> |
| 108 | An integer specifying the total number of sites in the replication |
| 109 | group. |
| 110 | </p> |
| 111 | </div> |
| 112 | </div> |
| 113 | <div class="sect2" lang="en" xml:lang="en"> |
| 114 | <div class="titlepage"> |
| 115 | <div> |
| 116 | <div> |
| 117 | <h3 class="title"><a id="idp9627792"></a>Errors</h3> |
| 118 | </div> |
| 119 | </div> |
| 120 | </div> |
| 121 | <p> |
| 122 | The <code class="methodname">DbEnv::rep_set_nsites()</code> <span> |
| 123 | |
| 124 | <span> |
| 125 | method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> |
| 126 | exception, encapsulating one of the following non-zero errors, or return one |
| 127 | of the following non-zero errors: |
| 128 | </span> |
| 129 | </span> |
| 130 | </p> |
| 131 | <div class="sect3" lang="en" xml:lang="en"> |
| 132 | <div class="titlepage"> |
| 133 | <div> |
| 134 | <div> |
| 135 | <h4 class="title"><a id="idp9636608"></a>EINVAL</h4> |
| 136 | </div> |
| 137 | </div> |
| 138 | </div> |
| 139 | <p> |
| 140 | If master leases are in use and replication has already been started; or if |
| 141 | an invalid flag value or parameter was specified. |
| 142 | </p> |
| 143 | </div> |
| 144 | </div> |
| 145 | <div class="sect2" lang="en" xml:lang="en"> |
| 146 | <div class="titlepage"> |
| 147 | <div> |
| 148 | <div> |
| 149 | <h3 class="title"><a id="idp9635528"></a>Class</h3> |
| 150 | </div> |
| 151 | </div> |
| 152 | </div> |
| 153 | <p> |
| 154 | <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> |
| 155 | </p> |
| 156 | </div> |
| 157 | <div class="sect2" lang="en" xml:lang="en"> |
| 158 | <div class="titlepage"> |
| 159 | <div> |
| 160 | <div> |
| 161 | <h3 class="title"><a id="idp9625768"></a>See Also</h3> |
| 162 | </div> |
| 163 | </div> |
| 164 | </div> |
| 165 | <p> |
| 166 | <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a> |
| 167 | </p> |
| 168 | </div> |
| 169 | </div> |
| 170 | <div class="navfooter"> |
| 171 | <hr /> |
| 172 | <table width="100%" summary="Navigation footer"> |
| 173 | <tr> |
| 174 | <td width="40%" align="left"><a accesskey="p" href="repset_limit.html">Prev</a> </td> |
| 175 | <td width="20%" align="center"> |
| 176 | <a accesskey="u" href="rep.html">Up</a> |
| 177 | </td> |
| 178 | <td width="40%" align="right"> <a accesskey="n" href="reppriority.html">Next</a></td> |
| 179 | </tr> |
| 180 | <tr> |
| 181 | <td width="40%" align="left" valign="top">DbEnv::rep_set_limit() </td> |
| 182 | <td width="20%" align="center"> |
| 183 | <a accesskey="h" href="index.html">Home</a> |
| 184 | </td> |
| 185 | <td width="40%" align="right" valign="top"> DbEnv::rep_set_priority()</td> |
| 186 | </tr> |
| 187 | </table> |
| 188 | </div> |
| 189 | </body> |
| 190 | </html> |