1<!--$Id: rep_config.so,v 1.10 2008/01/19 14:12:59 bostic Exp $-->
2<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
3<!--See the file LICENSE for redistribution information.-->
4<html>
5<head>
6<title>Berkeley DB: DbEnv::rep_set_config</title>
7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
9</head>
10<body bgcolor=white>
11<table width="100%"><tr valign=top>
12<td>
13<b>DbEnv::rep_set_config</b>
14</td>
15<td align=right>
16<a href="/api_cxx/api_core.html"><img src="/images/api.gif" alt="API"></a>
17<a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a></td>
18</tr></table>
19<hr size=1 noshade>
20<tt>
21<b><pre>
22#include &lt;db_cxx.h&gt;
23<p>
24int
25DbEnv::rep_set_config(u_int32_t which, int onoff);
26<p>
27int
28DbEnv::rep_get_config(u_int32_t which, int *onoffp);
29</pre></b>
30<hr size=1 noshade>
31<b>Description: DbEnv::rep_set_config</b>
32<p>The DbEnv::rep_set_config method method configures the Berkeley DB replication
33subsystem.</p>
34<p>The database environment's replication subsystem may also be configured using the
35environment's <a href="/ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file.  The syntax of the entry in that
36file is a single line with the string "rep_set_config", one or more whitespace
37characters, and the method <b>which</b> parameter as a string; for example,
38"rep_set_config DB_REP_CONF_NOWAIT".
39Because the <a href="/ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment
40is opened, it will silently overrule configuration done before that
41time.</p>
42<p>The DbEnv::rep_set_config method configures a database environment, not only operations
43performed using the specified <a href="/api_cxx/env_class.html">DbEnv</a> handle.</p>
44<p>The DbEnv::rep_set_config method may be called at any time during the life of the
45application.</p>
46<p>The DbEnv::rep_set_config method
47either returns a non-zero error value
48or throws an exception that encapsulates a non-zero error value on
49failure, and returns 0 on success.
50</p>
51<b>Parameters</b> <br>
52 <b>onoff</b><ul compact><li>If the <b>onoff</b> parameter is zero, the configuration flag is turned
53off.  Otherwise, it is turned on.</ul>
54 <b>which</b><ul compact><li>The <b>which</b> parameter must be set to one of the following values:
55<br>
56<b><a name="DB_REP_CONF_BULK">DB_REP_CONF_BULK</a></b><ul compact><li>The replication master sends groups of records to the clients in a
57single network transfer (defaults to off).</ul>
58<b><a name="DB_REP_CONF_DELAYCLIENT">DB_REP_CONF_DELAYCLIENT</a></b><ul compact><li>The client should delay synchronizing to a newly declared master
59(defaults to off).  Clients configured in this way will remain
60unsynchronized until the application calls the <a href="/api_cxx/rep_sync.html">DbEnv::rep_sync</a> method.</ul>
61<b><a name="DB_REP_CONF_LEASE">DB_REP_CONF_LEASE</a></b><ul compact><li>Master leases will be used for this site (defaults to off).
62<p>Configuring this option may result in <a name="DB_REP_LEASE_EXPIRED">DB_REP_LEASE_EXPIRED</a>
63error returns from the <a href="/api_cxx/db_get.html">Db::get</a> and <a href="/api_cxx/dbc_get.html">Dbc::get</a> methods when
64attempting to read entries from a database after the site's master lease
65has expired.</p>
66<p>The DbEnv::rep_set_config method may not be called after the <a href="/api_cxx/repmgr_start.html">DbEnv::repmgr_start</a> or <a href="/api_cxx/rep_start.html">DbEnv::rep_start</a> methods are
67called.</p>
68Once this option is turned on, it may never be turned off.</ul>
69<b><a name="DB_REP_CONF_NOAUTOINIT">DB_REP_CONF_NOAUTOINIT</a></b><ul compact><li>The replication master will not automatically re-initialize outdated
70clients (defaults to off).</ul>
71<b><a name="DB_REP_CONF_NOWAIT">DB_REP_CONF_NOWAIT</a></b><ul compact><li>Berkeley DB method calls that would normally block while clients are in
72recovery will return errors immediately (defaults to off).</ul>
73<b><a name="DB_REPMGR_CONF_2SITE_STRICT">DB_REPMGR_CONF_2SITE_STRICT</a></b><ul compact><li>Replication Manager observes the strict "majority" rule in managing
74elections, even in a group with only 2 sites.  This means the client in
75a 2-site group will be unable to take over as master if the original
76master fails or becomes disconnected.  (See the
77<a href="/ref/rep/elect.html">Elections</a> section in the Berkeley DB
78Reference Guide for more information.)  Both sites in the replication
79group should have the same value for this parameter.</ul>
80<br></ul>
81<br>
82<br><b>Errors</b>
83<p>The DbEnv::rep_set_config method
84may fail and throw
85<a href="/api_cxx/except_class.html">DbException</a>,
86encapsulating one of the following non-zero errors, or return one of
87the following non-zero errors:</p>
88<br>
89<b>EINVAL</b><ul compact><li>An
90invalid flag value or parameter was specified.</ul>
91<br>
92<hr size=1 noshade>
93<b>Description: DbEnv::rep_get_config</b>
94<p>The DbEnv::rep_get_config method returns whether the specified <b>which</b>
95parameter is currently set or not.</p>
96<p>The DbEnv::rep_get_config method may be called at any time during the life of the
97application.</p>
98<p>The DbEnv::rep_get_config method
99either returns a non-zero error value
100or throws an exception that encapsulates a non-zero error value on
101failure, and returns 0 on success.
102</p>
103<b>Parameters</b> <br>
104 <b>which</b><ul compact><li>The <b>which</b> parameter is the message value for which configuration
105is being checked.</ul>
106 <b>onoffp</b><ul compact><li>The <b>onoffp</b> parameter references memory into which
107 the configuration of the specified <b>which</b> parameter is copied.</ul> If the returned <b>onoff</b> value is zero, the parameter is off;
108otherwise on.
109<br>
110<hr size=1 noshade>
111<br><b>Class</b>
112<a href="/api_cxx/env_class.html">DbEnv</a>
113<br><b>See Also</b>
114<a href="/api_cxx/rep_list.html">Replication and Related Methods</a>
115</tt>
116<table width="100%"><tr><td><br></td><td align=right>
117<a href="/api_cxx/api_core.html"><img src="/images/api.gif" alt="API"></a><a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a>
118</td></tr></table>
119<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
120</body>
121</html>
122