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_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 10. Replication Methods" /> 11 <link rel="prev" href="repstat_print.html" title="DB_ENV->rep_stat_print()" /> 12 <link rel="next" href="repmgrremote_site.html" title="DB_ENV->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">DB_ENV->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 10. 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>DB_ENV->rep_sync()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db.h> 39 40int 41DB_ENV->rep_sync(DB_ENV *env, u_int32_t flags); </pre> 42 <p> 43 The <code class="methodname">DB_ENV->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="DB_ENV->rep_set_config()">DB_ENV->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">DB_ENV->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="DB_ENV->open()">DB_ENV->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="DB_ENV->rep_set_transport()">DB_ENV->rep_set_transport()</a> 65 method. 66 </p> 67 <p> 68 The <code class="methodname">DB_ENV->rep_sync()</code> <span> 69 <span> 70 method returns a non-zero error value on failure and 0 on success. 71 </span> 72 73 </span> 74 </p> 75 <div class="sect2" lang="en" xml:lang="en"> 76 <div class="titlepage"> 77 <div> 78 <div> 79 <h3 class="title"><a id="id1702239"></a>Parameters</h3> 80 </div> 81 </div> 82 </div> 83 <div class="sect3" lang="en" xml:lang="en"> 84 <div class="titlepage"> 85 <div> 86 <div> 87 <h4 class="title"><a id="id1702262"></a>flags</h4> 88 </div> 89 </div> 90 </div> 91 <p> 92 The <span class="bold"><strong>flags</strong></span> parameter is currently 93 unused, and must be set to 0. 94 </p> 95 </div> 96 </div> 97 <div class="sect2" lang="en" xml:lang="en"> 98 <div class="titlepage"> 99 <div> 100 <div> 101 <h3 class="title"><a id="id1702433"></a>Errors</h3> 102 </div> 103 </div> 104 </div> 105 <p> 106 The <code class="methodname">DB_ENV->rep_sync()</code> <span> 107 <span> 108 method may fail and return one of the following non-zero errors: 109 </span> 110 111 </span> 112 </p> 113 <div class="sect3" lang="en" xml:lang="en"> 114 <div class="titlepage"> 115 <div> 116 <div> 117 <h4 class="title"><a id="id1702246"></a>EINVAL</h4> 118 </div> 119 </div> 120 </div> 121 <p> 122If the database environment was not already configured to communicate 123with a replication group by a call to 124<a class="xref" href="reptransport.html" title="DB_ENV->rep_set_transport()">DB_ENV->rep_set_transport()</a>; 125the database environment was not already opened; 126 or if an invalid flag value or parameter was specified. 127 </p> 128 </div> 129 </div> 130 <div class="sect2" lang="en" xml:lang="en"> 131 <div class="titlepage"> 132 <div> 133 <div> 134 <h3 class="title"><a id="id1702259"></a>Class</h3> 135 </div> 136 </div> 137 </div> 138 <p> 139 <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> 140 </p> 141 </div> 142 <div class="sect2" lang="en" xml:lang="en"> 143 <div class="titlepage"> 144 <div> 145 <div> 146 <h3 class="title"><a id="id1702328"></a>See Also</h3> 147 </div> 148 </div> 149 </div> 150 <p> 151 <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a> 152 </p> 153 </div> 154 </div> 155 <div class="navfooter"> 156 <hr /> 157 <table width="100%" summary="Navigation footer"> 158 <tr> 159 <td width="40%" align="left"><a accesskey="p" href="repstat_print.html">Prev</a> </td> 160 <td width="20%" align="center"> 161 <a accesskey="u" href="rep.html">Up</a> 162 </td> 163 <td width="40%" align="right"> <a accesskey="n" href="repmgrremote_site.html">Next</a></td> 164 </tr> 165 <tr> 166 <td width="40%" align="left" valign="top">DB_ENV->rep_stat_print() </td> 167 <td width="20%" align="center"> 168 <a accesskey="h" href="index.html">Home</a> 169 </td> 170 <td width="40%" align="right" valign="top"> DB_ENV->repmgr_add_remote_site()</td> 171 </tr> 172 </table> 173 </div> 174 </body> 175</html> 176