• 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/api_reference/C/
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-&gt;rep_set_config()</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="repclockskew.html" title="DB_ENV-&gt;rep_set_clockskew()" />
12    <link rel="next" href="repset_limit.html" title="DB_ENV-&gt;rep_set_limit()" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">DB_ENV-&gt;rep_set_config()</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="repclockskew.html">Prev</a>��</td>
22          <th width="60%" align="center">Chapter��10.��
23                Replication Methods
24        </th>
25          <td width="20%" align="right">��<a accesskey="n" href="repset_limit.html">Next</a></td>
26        </tr>
27      </table>
28      <hr />
29    </div>
30    <div class="sect1" lang="en" xml:lang="en">
31      <div class="titlepage">
32        <div>
33          <div>
34            <h2 class="title" style="clear: both"><a id="repconfig"></a>DB_ENV-&gt;rep_set_config()</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">#include &lt;db.h&gt;
39
40int
41DB_ENV-&gt;rep_set_config(DB_ENV *env, u_int32_t which, int onoff);  </pre>
42      <p>
43         The <code class="methodname">DB_ENV-&gt;rep_set_config()</code> method configures the Berkeley DB
44         replication subsystem.
45    </p>
46      <p>
47         The database environment's replication subsystem may also be
48         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
49         syntax of the entry in that file is a single line with the string
50         "rep_set_config", one or more whitespace characters, and the method
51         <span class="bold"><strong>which</strong></span> parameter as a string; for
52         example, "rep_set_config DB_REP_CONF_NOWAIT". Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is
53         read when the database environment is opened, it will silently
54         overrule configuration done before that time.
55    </p>
56      <p>
57         The <code class="methodname">DB_ENV-&gt;rep_set_config()</code> method configures a database
58         environment, not only operations performed using the specified 
59         <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a>  handle.
60    </p>
61      <p>
62         The <code class="methodname">DB_ENV-&gt;rep_set_config()</code> method may not be
63         called to set in-memory replication after the environment is
64         opened using the 
65         <a class="xref" href="envopen.html" title="DB_ENV-&gt;open()">DB_ENV-&gt;open()</a> method. 
66         This method may also not be called to set master leases after the
67         <a class="xref" href="repstart.html" title="DB_ENV-&gt;rep_start()">DB_ENV-&gt;rep_start()</a> or 
68         <a class="xref" href="repmgrstart.html" title="DB_ENV-&gt;repmgr_start()">DB_ENV-&gt;repmgr_start()</a> methods
69         are called.  For all other <span class="bold"><strong>which</strong></span>
70         parameters, this method may be called at any time during the life
71         of the application.
72    </p>
73      <p>
74         The <code class="methodname">DB_ENV-&gt;rep_set_config()</code> <span>
75            <span>
76                  method returns a non-zero error value on failure and 0 on success.
77            </span>
78            
79        </span>
80    </p>
81      <div class="sect2" lang="en" xml:lang="en">
82        <div class="titlepage">
83          <div>
84            <div>
85              <h3 class="title"><a id="id1698507"></a>Parameters</h3>
86            </div>
87          </div>
88        </div>
89        <div class="sect3" lang="en" xml:lang="en">
90          <div class="titlepage">
91            <div>
92              <div>
93                <h4 class="title"><a id="id1698294"></a>onoff</h4>
94              </div>
95            </div>
96          </div>
97          <p>
98                          If the <span class="bold"><strong>onoff</strong></span> parameter is zero, the
99                          configuration flag is turned off.
100Otherwise, it is turned on. All configuration flags are turned off by default.
101                     </p>
102        </div>
103        <div class="sect3" lang="en" xml:lang="en">
104          <div class="titlepage">
105            <div>
106              <div>
107                <h4 class="title"><a id="id1698668"></a>which</h4>
108              </div>
109            </div>
110          </div>
111          <p>
112                          The <span class="bold"><strong>which</strong></span> parameter must be set to
113                          one of the following values:
114                     </p>
115          <div class="itemizedlist">
116            <ul type="disc">
117              <li>
118                <p><a id="config_DB_REP_CONF_BULK"></a>
119                                <code class="literal">DB_REP_CONF_BULK</code>
120                            </p>
121                <p>
122                                The replication master sends groups of records to the clients in a
123                                single network transfer.
124                            </p>
125              </li>
126              <li>
127                <p><a id="config_DB_REP_CONF_DELAYCLIENT"></a>
128                                <code class="literal">DB_REP_CONF_DELAYCLIENT</code>
129                            </p>
130                <p>
131                                The client should delay synchronizing to a newly declared master.  Clients configured in this way will remain
132                                unsynchronized until the application calls the 
133                                <a class="xref" href="repsync.html" title="DB_ENV-&gt;rep_sync()">DB_ENV-&gt;rep_sync()</a>  method.
134                            </p>
135              </li>
136              <li>
137                <p><a id="config_DB_REP_CONF_INMEM"></a>
138                                <code class="literal">DB_REP_CONF_INMEM</code>
139                            </p>
140                <p>
141                                Store internal replication information in memory only.
142                            </p>
143                <p>
144                                By default, replication creates files in the environment home directory
145                                to preserve some internal information. If this configuration flag is turned
146                                on, replication only stores this internal information in-memory and cannot
147                                keep persistent state across a site crash or reboot. This results in the
148                                following limitations:
149                            </p>
150                <div class="itemizedlist">
151                  <ul type="circle">
152                    <li>
153                      <p>
154                                        A master site should not reappoint itself master
155                                        immediately after crashing or rebooting because the application would incur a
156                                        slightly higher risk of client crashes. The former master site should rejoin
157                                        the replication group as a client. The application should either hold an
158                                        election or appoint a different site to be the next master.
159                                    </p>
160                    </li>
161                    <li>
162                      <p>
163                                        An application has a slightly higher risk that elections will fail or be
164                                        unable to complete. Calling additional elections should eventually yield a
165                                        winner.
166                                    </p>
167                    </li>
168                    <li>
169                      <p>
170                                        An application has a slight risk that the wrong site may win an election,
171                                        resulting in the loss of some data. This is consistent with the general loss
172                                        of data durability when running in-memory.
173                                    </p>
174                    </li>
175                  </ul>
176                </div>
177                <p>
178                                This configuration flag can only be turned on before the environment
179                                is opened with the <a class="xref" href="envopen.html" title="DB_ENV-&gt;open()">DB_ENV-&gt;open()</a>
180                                method. Its value cannot be changed while the environment is open.
181                            </p>
182              </li>
183              <li>
184                <p>
185                                <code class="literal">DB_REP_CONF_LEASE</code>
186                            </p>
187                <p>
188                                Master leases will be used for this site.
189                            </p>
190                <p>
191                                Configuring this option may result in
192                                <code class="literal">DB_REP_LEASE_EXPIRED</code> error returns
193                                from the <a class="xref" href="dbget.html" title="DB-&gt;get()">DB-&gt;get()</a>  and
194                                <a class="xref" href="dbcget.html" title="DBcursor-&gt;get()">DBcursor-&gt;get()</a>  methods
195                                when attempting to read entries from a database after the site's
196                                master lease has expired.
197                            </p>
198                <p>
199                                This configuration flag may not be set after the
200                                <a class="xref" href="repmgrstart.html" title="DB_ENV-&gt;repmgr_start()">DB_ENV-&gt;repmgr_start()</a>  method or the
201                                <a class="xref" href="repstart.html" title="DB_ENV-&gt;rep_start()">DB_ENV-&gt;rep_start()</a> 
202                                method is called.
203                            </p>
204              </li>
205              <li>
206                <p><a id="config_DB_REP_CONF_NOAUTOINIT"></a>
207                                <code class="literal">DB_REP_CONF_NOAUTOINIT</code>
208                            </p>
209                <p>
210                                The replication master will not automatically re-initialize outdated
211                                clients.
212                            </p>
213              </li>
214              <li>
215                <p><a id="config_DB_REP_CONF_NOWAIT"></a>
216                                <code class="literal">DB_REP_CONF_NOWAIT</code>
217                            </p>
218                <p>
219                                Berkeley DB method calls that would normally block while clients are
220                                in recovery will return errors immediately.
221                            </p>
222              </li>
223              <li>
224                <p><a id="config_DB_REPMGR_CONF_2SITE_STRICT"></a>
225                                <code class="literal">DB_REPMGR_CONF_2SITE_STRICT</code>
226                            </p>
227                <p>
228                                Replication Manager observes the strict "majority" rule in managing
229                                elections, even in a group with only 2 sites.  This means the client
230                                in a 2-site group will be unable to take over as master if the
231                                original master fails or becomes disconnected.  (See the <a href="../../programmer_reference/rep_elect.html" class="olink">Elections</a> section in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em> for more information.)  Both sites in the
232                                replication group should have the same value for this configuration flag.
233                            </p>
234              </li>
235            </ul>
236          </div>
237        </div>
238      </div>
239      <div class="sect2" lang="en" xml:lang="en">
240        <div class="titlepage">
241          <div>
242            <div>
243              <h3 class="title"><a id="id1698684"></a>Errors</h3>
244            </div>
245          </div>
246        </div>
247        <p>
248                         The <code class="methodname">DB_ENV-&gt;rep_set_config()</code> <span>
249            <span>
250                 method may fail and return one of the following non-zero errors:
251            </span>
252            
253        </span>
254                    </p>
255        <div class="sect3" lang="en" xml:lang="en">
256          <div class="titlepage">
257            <div>
258              <div>
259                <h4 class="title"><a id="id1698868"></a>EINVAL</h4>
260              </div>
261            </div>
262          </div>
263          <p>
264                If setting in-memory replication after the database environment is already
265                opened; if setting master leases after replication is started; if setting
266                the 2-site strict majority rule for a Base API application;
267                or if an invalid flag value or parameter was specified.
268            </p>
269        </div>
270      </div>
271      <div class="sect2" lang="en" xml:lang="en">
272        <div class="titlepage">
273          <div>
274            <div>
275              <h3 class="title"><a id="id1699036"></a>Class</h3>
276            </div>
277          </div>
278        </div>
279        <p>
280                <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a>  
281            </p>
282      </div>
283      <div class="sect2" lang="en" xml:lang="en">
284        <div class="titlepage">
285          <div>
286            <div>
287              <h3 class="title"><a id="id1698657"></a>See Also</h3>
288            </div>
289          </div>
290        </div>
291        <p>
292                     <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a> 
293                </p>
294      </div>
295    </div>
296    <div class="navfooter">
297      <hr />
298      <table width="100%" summary="Navigation footer">
299        <tr>
300          <td width="40%" align="left"><a accesskey="p" href="repclockskew.html">Prev</a>��</td>
301          <td width="20%" align="center">
302            <a accesskey="u" href="rep.html">Up</a>
303          </td>
304          <td width="40%" align="right">��<a accesskey="n" href="repset_limit.html">Next</a></td>
305        </tr>
306        <tr>
307          <td width="40%" align="left" valign="top">DB_ENV-&gt;rep_set_clockskew()��</td>
308          <td width="20%" align="center">
309            <a accesskey="h" href="index.html">Home</a>
310          </td>
311          <td width="40%" align="right" valign="top">��DB_ENV-&gt;rep_set_limit()</td>
312        </tr>
313      </table>
314    </div>
315  </body>
316</html>
317