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_sync()</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="repstat_print.html" title="DbEnv::rep_stat_print()" /> 12 <link rel="next" href="repmgrremote_site.html" title="DbEnv::repmgr_add_remote_site()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DbEnv::rep_sync()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="repstat_print.html">Prev</a>��</td> 22 <th width="60%" align="center">Chapter��11.�� 23 Replication Methods 24 </th> 25 <td width="20%" align="right">��<a accesskey="n" href="repmgrremote_site.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="repsync"></a>DbEnv::rep_sync()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41DbEnv::rep_sync(u_int32_t flags);</pre> 42 <p> 43 The <code class="methodname">DbEnv::rep_sync()</code> method forces master synchronization to begin 44 for this client. This method is the other half of setting the 45 <a class="link" href="repconfig.html#config_DB_REP_CONF_DELAYCLIENT">DB_REP_CONF_DELAYCLIENT</a> 46 flag via the <a class="xref" href="repconfig.html" title="DbEnv::rep_set_config()">DbEnv::rep_set_config()</a> 47 method. 48 </p> 49 <p> 50 If an application has configured delayed master synchronization, the 51 application must synchronize explicitly (otherwise the client will 52 remain out-of-date and will ignore all database changes forwarded from 53 the replication group master). The <code class="methodname">DbEnv::rep_sync()</code> method may be 54 called any time after the client application learns that the new 55 master has been established (by receiving a 56 <a class="link" href="envevent_notify.html#event_notify_DB_EVENT_REP_NEWMASTER">DB_EVENT_REP_NEWMASTER</a> 57 event notification). 58 </p> 59 <p> 60 Before calling this method, the enclosing database environment must 61 already have been opened by calling the 62 <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> method and must 63 already have been configured to send replication messages by 64 calling the <a class="xref" href="reptransport.html" title="DbEnv::rep_set_transport()">DbEnv::rep_set_transport()</a> 65 method. 66 </p> 67 <p> 68 The <code class="methodname">DbEnv::rep_sync()</code> <span> 69 70 <span> 71 method either returns a non-zero error value or throws an 72 exception that encapsulates a non-zero error value on 73 failure, and returns 0 on success. 74 </span> 75 </span> 76 </p> 77 <div class="sect2" lang="en" xml:lang="en"> 78 <div class="titlepage"> 79 <div> 80 <div> 81 <h3 class="title"><a id="id1706833"></a>Parameters</h3> 82 </div> 83 </div> 84 </div> 85 <div class="sect3" lang="en" xml:lang="en"> 86 <div class="titlepage"> 87 <div> 88 <div> 89 <h4 class="title"><a id="id1706849"></a>flags</h4> 90 </div> 91 </div> 92 </div> 93 <p> 94 The <span class="bold"><strong>flags</strong></span> parameter is currently 95 unused, and must be set to 0. 96 </p> 97 </div> 98 </div> 99 <div class="sect2" lang="en" xml:lang="en"> 100 <div class="titlepage"> 101 <div> 102 <div> 103 <h3 class="title"><a id="id1707033"></a>Errors</h3> 104 </div> 105 </div> 106 </div> 107 <p> 108 The <code class="methodname">DbEnv::rep_sync()</code> <span> 109 110 <span> 111 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter��6.��The DbException Class">DbException</a> 112 exception, encapsulating one of the following non-zero errors, or return one 113 of the following non-zero errors: 114 </span> 115 </span> 116 </p> 117 <div class="sect3" lang="en" xml:lang="en"> 118 <div class="titlepage"> 119 <div> 120 <div> 121 <h4 class="title"><a id="id1706976"></a>EINVAL</h4> 122 </div> 123 </div> 124 </div> 125 <p> 126If the database environment was not already configured to communicate 127with a replication group by a call to 128<a class="xref" href="reptransport.html" title="DbEnv::rep_set_transport()">DbEnv::rep_set_transport()</a>; 129the database environment was not already opened; 130 or if an invalid flag value or parameter was specified. 131 </p> 132 </div> 133 </div> 134 <div class="sect2" lang="en" xml:lang="en"> 135 <div class="titlepage"> 136 <div> 137 <div> 138 <h3 class="title"><a id="id1706845"></a>Class</h3> 139 </div> 140 </div> 141 </div> 142 <p> 143 <a class="link" href="env.html" title="Chapter��5.�� The DbEnv Handle">DbEnv</a> 144 </p> 145 </div> 146 <div class="sect2" lang="en" xml:lang="en"> 147 <div class="titlepage"> 148 <div> 149 <div> 150 <h3 class="title"><a id="id1706984"></a>See Also</h3> 151 </div> 152 </div> 153 </div> 154 <p> 155 <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a> 156 </p> 157 </div> 158 </div> 159 <div class="navfooter"> 160 <hr /> 161 <table width="100%" summary="Navigation footer"> 162 <tr> 163 <td width="40%" align="left"><a accesskey="p" href="repstat_print.html">Prev</a>��</td> 164 <td width="20%" align="center"> 165 <a accesskey="u" href="rep.html">Up</a> 166 </td> 167 <td width="40%" align="right">��<a accesskey="n" href="repmgrremote_site.html">Next</a></td> 168 </tr> 169 <tr> 170 <td width="40%" align="left" valign="top">DbEnv::rep_stat_print()��</td> 171 <td width="20%" align="center"> 172 <a accesskey="h" href="index.html">Home</a> 173 </td> 174 <td width="40%" align="right" valign="top">��DbEnv::repmgr_add_remote_site()</td> 175 </tr> 176 </table> 177 </div> 178 </body> 179</html> 180