Debian Codegraph @

docs/api_reference/C/repconfig.html

raw symbols SCIP
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 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-&gt;rep_set_config()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="repclockskew.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_limit.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="repconfig"></a>DB_ENV-&gt;rep_set_config()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db.h&gt;
42
43 int
44 DB_ENV-&gt;rep_set_config(DB_ENV *env, u_int32_t which, int onoff); </pre>
45 <p>
46 The <code class="methodname">DB_ENV-&gt;rep_set_config()</code> method configures the Berkeley DB
47 replication subsystem.
48 </p>
49 <p>
50 The database environment's replication subsystem may also be
51 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
52 of the entry in that file is a single line with the string
53 "rep_set_config", one or more whitespace characters, and the
54 method <span class="bold"><strong>which</strong></span> parameter as a
55 string and optionally one or more whitespace characters, and the
56 string "on" or "off". If the optional string is omitted, the
57 default is "on"; for example, "rep_set_config DB_REP_CONF_NOWAIT"
58 or "rep_set_config DB_REP_CONF_NOWAIT on". Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a>
59 file is read when the database environment is opened, it will
60 silently overrule configuration done before that time.
61 </p>
62 <p>
63 The <code class="methodname">DB_ENV-&gt;rep_set_config()</code> method configures a database
64 environment, not only operations performed using the specified
65 <a class="link" href="env.html" title="Chapter 5.  The DB_ENV Handle">DB_ENV</a> handle.
66 </p>
67 <p>
68 The <code class="methodname">DB_ENV-&gt;rep_set_config()</code> method may not be
69 called to set in-memory replication after the environment is
70 opened using the
71 <a class="xref" href="envopen.html" title="DB_ENV-&gt;open()">DB_ENV-&gt;open()</a> method.
72 This method may also not be called to set master leases after the
73 <a class="xref" href="repstart.html" title="DB_ENV-&gt;rep_start()">DB_ENV-&gt;rep_start()</a> or
74 <a class="xref" href="repmgrstart.html" title="DB_ENV-&gt;repmgr_start()">DB_ENV-&gt;repmgr_start()</a> methods
75 are called. For all other <span class="bold"><strong>which</strong></span>
76 parameters, this method may be called at any time during the life
77 of the application.
78 </p>
79 <p>
80 The <code class="methodname">DB_ENV-&gt;rep_set_config()</code> <span>
81 <span>
82 method returns a non-zero error value on failure and 0 on success.
83 </span>
84
85 </span>
86 </p>
87 <div class="sect2" lang="en" xml:lang="en">
88 <div class="titlepage">
89 <div>
90 <div>
91 <h3 class="title"><a id="idp54103200"></a>Parameters</h3>
92 </div>
93 </div>
94 </div>
95 <div class="sect3" lang="en" xml:lang="en">
96 <div class="titlepage">
97 <div>
98 <div>
99 <h4 class="title"><a id="idp54044288"></a>which</h4>
100 </div>
101 </div>
102 </div>
103 <p>
104 The <span class="bold"><strong>which</strong></span> parameter must be set to
105 one of the following values:
106 </p>
107 <div class="itemizedlist">
108 <ul type="disc">
109 <li>
110 <p><a id="config_DB_REP_CONF_AUTOINIT"></a>
111 <code class="literal">DB_REP_CONF_AUTOINIT</code>
112 </p>
113 <p>
114 The replication master will automatically re-initialize outdated
115 clients. This option is turned on by default.
116 </p>
117 </li>
118 <li>
119 <p><a id="config_DB_REP_CONF_BULK"></a>
120 <code class="literal">DB_REP_CONF_BULK</code>
121 </p>
122 <p>
123 The replication master sends groups of records to the clients in a
124 single network transfer.
125 </p>
126 </li>
127 <li>
128 <p><a id="config_DB_REP_CONF_DELAYCLIENT"></a>
129 <code class="literal">DB_REP_CONF_DELAYCLIENT</code>
130 </p>
131 <p>
132 The client should delay synchronizing to a newly declared master.
133 Clients configured in this way will remain
134 unsynchronized until the application calls the
135 <a class="xref" href="repsync.html" title="DB_ENV-&gt;rep_sync()">DB_ENV-&gt;rep_sync()</a> method.
136 </p>
137 </li>
138 <li>
139 <p><a id="config_DB_REP_CONF_INMEM"></a>
140 <code class="literal">DB_REP_CONF_INMEM</code>
141 </p>
142 <p>
143 Store internal replication information in memory only.
144 </p>
145 <p>
146 By default, replication creates files in the
147 environment home directory to preserve some
148 internal information. If this configuration flag is
149 turned on, replication only stores this internal
150 information in-memory and cannot keep persistent
151 state across a site crash or reboot. This results
152 in the following limitations:
153 </p>
154 <div class="itemizedlist">
155 <ul type="circle">
156 <li>
157 <p>
158 A master site should not reappoint itself
159 master immediately after crashing or
160 rebooting because the application would
161 incur a slightly higher risk of client
162 crashes. The former master site should
163 rejoin the replication group as a client.
164 The application should either hold an
165 election or appoint a different site to be
166 the next master.
167 </p>
168 </li>
169 <li>
170 <p>
171 An application has a slightly higher risk
172 that elections will fail or be unable to
173 complete. Calling additional elections
174 should eventually yield a winner.
175 </p>
176 </li>
177 <li>
178 <p>
179 An application has a slight risk that the
180 wrong site may win an election, resulting
181 in the loss of some data. This is
182 consistent with the general loss of data
183 durability when running in-memory.
184 </p>
185 </li>
186 <li>
187 <p>
188 Replication Manager applications will no
189 longer maintain group membership
190 information persistently on-disk. For more
191 information, see <a href="../../programmer_reference/rep_filename.html" class="olink">Managing Replication Files</a> in the
192 <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>.
193 </p>
194 </li>
195 </ul>
196 </div>
197 <p>
198 This configuration flag can only be turned on
199 before the environment is opened with the
200 <a class="xref" href="envopen.html" title="DB_ENV-&gt;open()">DB_ENV-&gt;open()</a>
201 method. Its value cannot be changed while the
202 environment is open. All sites in the replication
203 group should have the same value for this
204 configuration flag.
205 </p>
206 </li>
207 <li>
208 <p>
209 <code class="literal">DB_REP_CONF_LEASE</code>
210 </p>
211 <p>
212 Master leases will be used for this site.
213 </p>
214 <p>
215 Configuring this option may result in
216 <code class="literal">DB_REP_LEASE_EXPIRED</code> error returns
217 from the <a class="xref" href="dbget.html" title="DB-&gt;get()">DB-&gt;get()</a> and
218 <a class="xref" href="dbcget.html" title="DBcursor-&gt;get()">DBcursor-&gt;get()</a> methods
219 when attempting to read entries from a database after the site's
220 master lease has expired.
221 </p>
222 <p>
223 This configuration flag may not be set after the
224 <a class="xref" href="repmgrstart.html" title="DB_ENV-&gt;repmgr_start()">DB_ENV-&gt;repmgr_start()</a> method or the
225 <a class="xref" href="repstart.html" title="DB_ENV-&gt;rep_start()">DB_ENV-&gt;rep_start()</a>
226 method is called. All sites in the replication
227 group should have the same value for this
228 configuration flag.
229 </p>
230 </li>
231 <li>
232 <p><a id="config_DB_REP_CONF_NOWAIT"></a>
233 <code class="literal">DB_REP_CONF_NOWAIT</code>
234 </p>
235 <p>
236 Berkeley DB method calls that would normally block while clients are
237 in recovery will return errors immediately.
238 </p>
239 </li>
240 <li>
241 <p><a id="config_DB_REPMGR_CONF_ELECTIONS"></a>
242 <code class="literal">DB_REPMGR_CONF_ELECTIONS</code>
243 </p>
244 <p>
245 Replication Manager automatically runs elections to
246 choose a new master when the old master appears to
247 have become disconnected. This option is turned on
248 by default.
249 </p>
250 <p>
251 If this option is turned off, the application is
252 responsible for assigning the new master
253 explicitly, by calling the
254 <code class="methodname">DB_ENV-&gt;repmgr_start()</code>
255 method.
256 </p>
257 <div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;">
258 <h3 class="title">Caution</h3>
259 <p>
260 Most Replication Manager
261 applications should accept the default automatic
262 behavior. Allowing two sites in a replication
263 group to act as master simultaneously can lead to
264 loss of data.
265 </p>
266 </div>
267 <p>
268 In an application with multiple processes per
269 database environment, only the main replication
270 process may change this configuration setting.
271 </p>
272 </li>
273 <li>
274 <p><a id="config_DB_REPMGR_CONF_2SITE_STRICT"></a>
275 <code class="literal">DB_REPMGR_CONF_2SITE_STRICT</code>
276 </p>
277 <p>
278 Replication Manager observes the strict "majority" rule in managing
279 elections, even in a group with only 2 sites. This means the client
280 in a 2-site group will be unable to take over as master if the
281 original master fails or becomes disconnected. (See the
282 <a href="../../programmer_reference/rep_twosite.html" class="olink">
283 Special considerations for two-site replication groups
284 </a>
285 section in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em> for more information.)
286 Both sites in the replication group should have the same value for this
287 configuration flag. This option is turned on by
288 default.
289 </p>
290 </li>
291 </ul>
292 </div>
293 </div>
294 <div class="sect3" lang="en" xml:lang="en">
295 <div class="titlepage">
296 <div>
297 <div>
298 <h4 class="title"><a id="idp54131888"></a>onoff</h4>
299 </div>
300 </div>
301 </div>
302 <p>
303 If the <span class="bold"><strong>onoff</strong></span> parameter
304 is zero, the configuration flag is turned off.
305 Otherwise, it is turned on. Most configuration flags are
306 turned off by default, exceptions are noted above.
307 </p>
308 </div>
309 </div>
310 <div class="sect2" lang="en" xml:lang="en">
311 <div class="titlepage">
312 <div>
313 <div>
314 <h3 class="title"><a id="idp54111024"></a>Errors</h3>
315 </div>
316 </div>
317 </div>
318 <p>
319 The <code class="methodname">DB_ENV-&gt;rep_set_config()</code> <span>
320 <span>
321 method may fail and return one of the following non-zero errors:
322 </span>
323
324 </span>
325 </p>
326 <div class="sect3" lang="en" xml:lang="en">
327 <div class="titlepage">
328 <div>
329 <div>
330 <h4 class="title"><a id="idp54122464"></a>EINVAL</h4>
331 </div>
332 </div>
333 </div>
334 <p>
335 If setting in-memory replication after the database environment is already
336 opened; if setting master leases after replication is started; if setting
337 the 2-site strict majority rule for a Base API application;
338 or if an invalid flag value or parameter was specified.
339 </p>
340 </div>
341 </div>
342 <div class="sect2" lang="en" xml:lang="en">
343 <div class="titlepage">
344 <div>
345 <div>
346 <h3 class="title"><a id="idp54113984"></a>Class</h3>
347 </div>
348 </div>
349 </div>
350 <p>
351 <a class="link" href="env.html" title="Chapter 5.  The DB_ENV Handle">DB_ENV</a>
352 </p>
353 </div>
354 <div class="sect2" lang="en" xml:lang="en">
355 <div class="titlepage">
356 <div>
357 <div>
358 <h3 class="title"><a id="idp54072160"></a>See Also</h3>
359 </div>
360 </div>
361 </div>
362 <p>
363 <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a>
364 </p>
365 </div>
366 </div>
367 <div class="navfooter">
368 <hr />
369 <table width="100%" summary="Navigation footer">
370 <tr>
371 <td width="40%" align="left"><a accesskey="p" href="repclockskew.html">Prev</a> </td>
372 <td width="20%" align="center">
373 <a accesskey="u" href="rep.html">Up</a>
374 </td>
375 <td width="40%" align="right"> <a accesskey="n" href="repset_limit.html">Next</a></td>
376 </tr>
377 <tr>
378 <td width="40%" align="left" valign="top">DB_ENV-&gt;rep_set_clockskew() </td>
379 <td width="20%" align="center">
380 <a accesskey="h" href="index.html">Home</a>
381 </td>
382 <td width="40%" align="right" valign="top"> DB_ENV-&gt;rep_set_limit()</td>
383 </tr>
384 </table>
385 </div>
386 </body>
387 </html>