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_start()</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="reptransport.html" title="DB_ENV->rep_set_transport()" /> 12 <link rel="next" href="repstat.html" title="DB_ENV->rep_stat()" /> 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->rep_start()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="reptransport.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="repstat.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="repstart"></a>DB_ENV->rep_start()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db.h> 39 40int 41DB_ENV->rep_start(DB_ENV *env, DBT *cdata, u_int32_t flags); </pre> 42 <p> 43 The <code class="methodname">DB_ENV->rep_start()</code> method configures the database environment as 44 a client or master in a group of replicated database environments. 45 </p> 46 <p> 47 The <code class="methodname">DB_ENV->rep_start()</code> method is not called by most replication 48 applications. It should only be called by Base API applications implementing 49 their own network transport layer, explicitly holding replication 50 group elections and handling replication messages outside of the 51 Replication Manager framework. 52 </p> 53 <p> 54 Replication master environments are the only database environments 55 where replicated databases may be modified. Replication client 56 environments are read-only as long as they are clients. Replication 57 client environments may be upgraded to be replication master 58 environments in the case that the current master fails or there is no 59 master present. If master leases are in use, this method cannot be 60 used to appoint a master, and should only be used to configure a database 61 environment as a master as the result of an election. 62 </p> 63 <p> 64 The enclosing database environment must already have been opened by 65 calling the <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> method and must 66 already have been configured to send replication messages by calling 67 the <a class="xref" href="reptransport.html" title="DB_ENV->rep_set_transport()">DB_ENV->rep_set_transport()</a> 68 method. 69 </p> 70 <p> 71 The <code class="methodname">DB_ENV->rep_start()</code> <span> 72 <span> 73 method returns a non-zero error value on failure and 0 on success. 74 </span> 75 76 </span> 77 </p> 78 <div class="sect2" lang="en" xml:lang="en"> 79 <div class="titlepage"> 80 <div> 81 <div> 82 <h3 class="title"><a id="id1700577"></a>Parameters</h3> 83 </div> 84 </div> 85 </div> 86 <div class="sect3" lang="en" xml:lang="en"> 87 <div class="titlepage"> 88 <div> 89 <div> 90 <h4 class="title"><a id="id1700596"></a>cdata</h4> 91 </div> 92 </div> 93 </div> 94 <p> 95 The <span class="bold"><strong>cdata</strong></span> parameter is an opaque data 96 item that is sent over the communication infrastructure when the client 97 comes online (see <a href="../../programmer_reference/rep_newsite.html" class="olink">Connecting to a new site</a> for more information). If no such information is useful, 98 <span class="bold"><strong>cdata</strong></span> should be NULL. 99 </p> 100 </div> 101 <div class="sect3" lang="en" xml:lang="en"> 102 <div class="titlepage"> 103 <div> 104 <div> 105 <h4 class="title"><a id="id1700457"></a>flags</h4> 106 </div> 107 </div> 108 </div> 109 <p> 110 The <span class="bold"><strong>flags</strong></span> parameter must be set to 111 one of the following values: 112 </p> 113 <div class="itemizedlist"> 114 <ul type="disc"> 115 <li> 116 <p> 117 <code class="literal">DB_REP_CLIENT</code> 118 </p> 119 <p> 120 Configure the environment as a replication client. 121 </p> 122 </li> 123 <li> 124 <p> 125 <code class="literal">DB_REP_MASTER</code> 126 </p> 127 <p> 128 Configure the environment as a replication master. 129 </p> 130 </li> 131 </ul> 132 </div> 133 </div> 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="id1700132"></a>Errors</h3> 140 </div> 141 </div> 142 </div> 143 <p> 144 The <code class="methodname">DB_ENV->rep_start()</code> <span> 145 <span> 146 method may fail and return one of the following non-zero errors: 147 </span> 148 149 </span> 150 </p> 151 <div class="sect3" lang="en" xml:lang="en"> 152 <div class="titlepage"> 153 <div> 154 <div> 155 <h4 class="title"><a id="id1700088"></a>DB_REP_UNAVAIL</h4> 156 </div> 157 <div> 158 <h4 class="title"><a id="id1700088"></a>DB_REP_UNAVAIL</h4> 159 </div> 160 </div> 161 </div> 162 <p> 163 If the flags parameter was passed as DB_REP_MASTER but the database 164 environment cannot currently become the replication master because it is temporarily initializing and is incomplete. 165 </p> 166 <p> 167 If the database environment was not already configured to communicate 168 with a replication group by a call to 169 <a class="xref" href="reptransport.html" title="DB_ENV->rep_set_transport()">DB_ENV->rep_set_transport()</a>; 170 the database environment was not already opened; 171 this method is called from a Replication Manager application; outstanding 172 master leases are granted; this method is used to appoint a new master when 173 master leases are in use; or if an invalid flag value or parameter was specified. 174 </p> 175 </div> 176 </div> 177 <div class="sect2" lang="en" xml:lang="en"> 178 <div class="titlepage"> 179 <div> 180 <div> 181 <h3 class="title"><a id="id1699914"></a>Class</h3> 182 </div> 183 </div> 184 </div> 185 <p> 186 <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a> 187 </p> 188 </div> 189 <div class="sect2" lang="en" xml:lang="en"> 190 <div class="titlepage"> 191 <div> 192 <div> 193 <h3 class="title"><a id="id1700594"></a>See Also</h3> 194 </div> 195 </div> 196 </div> 197 <p> 198 <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a> 199 </p> 200 </div> 201 </div> 202 <div class="navfooter"> 203 <hr /> 204 <table width="100%" summary="Navigation footer"> 205 <tr> 206 <td width="40%" align="left"><a accesskey="p" href="reptransport.html">Prev</a>��</td> 207 <td width="20%" align="center"> 208 <a accesskey="u" href="rep.html">Up</a> 209 </td> 210 <td width="40%" align="right">��<a accesskey="n" href="repstat.html">Next</a></td> 211 </tr> 212 <tr> 213 <td width="40%" align="left" valign="top">DB_ENV->rep_set_transport()��</td> 214 <td width="20%" align="center"> 215 <a accesskey="h" href="index.html">Home</a> 216 </td> 217 <td width="40%" align="right" valign="top">��DB_ENV->rep_stat()</td> 218 </tr> 219 </table> 220 </div> 221 </body> 222</html> 223