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_set_clockskew()</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="repmessage.html" title="DB_ENV->rep_process_message()" /> 12 <link rel="next" href="repconfig.html" title="DB_ENV->rep_set_config()" /> 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_set_clockskew()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="repmessage.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="repconfig.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="repclockskew"></a>DB_ENV->rep_set_clockskew()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db.h> 39 40int 41DB_ENV->rep_set_clockskew(DB_ENV *env, 42 u_int32_t fast_clock, u_int32_t slow_clock); </pre> 43 <p> 44 The <code class="methodname">DB_ENV->rep_set_clockskew()</code> method sets the clock skew ratio 45 among replication group members based on the fastest and slowest 46 measurements among the group for use with master leases. Calling this 47 method is optional; the default values for clock skew assume no skew. 48 The user must also configure leases via the <a class="xref" href="repconfig.html" title="DB_ENV->rep_set_config()">DB_ENV->rep_set_config()</a> 49 method. Additionally, the user must also set the master lease timeout 50 via the <a class="xref" href="repset_timeout.html" title="DB_ENV->rep_set_timeout()">DB_ENV->rep_set_timeout()</a> 51 method and the number of sites in the replication group via the 52 <a class="xref" href="repnsites.html" title="DB_ENV->rep_set_nsites()">DB_ENV->rep_set_nsites()</a> 53 method. These methods may be called in any order. For a description 54 of the clock skew values, see <a href="../../programmer_reference/rep_clock_skew.html" class="olink">Clock skew</a> 55 in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>. For a 56 description of master leases, see 57 <a href="../../programmer_reference/rep_lease.html" class="olink">Master leases</a> in the 58 <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>. 59 </p> 60 <p> 61 These arguments can be used to express either raw measurements of a 62 clock timing experiment or a percentage across machines. For example, if 63 a group of sites has a 2% variance, then <span class="bold"><strong>fast_clock</strong></span> should be set to 102, and 64 <span class="bold"><strong>slow_clock</strong></span> should be set to 100. Or, 65 for a 0.03% difference, you can use 10003 and 10000 respectively. 66 </p> 67 <p> 68 The database environment's replication subsystem may also be 69 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 70 syntax of the entry in that file is a single line with the string 71 "rep_set_clockskew", one or more whitespace characters, and the 72 clockskew specified in two parts: the fast_clock and the slow_clock. 73 For example, "rep_set_clockskew 102 100". Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is 74 read when the database environment is opened, it will silently 75 overrule configuration done before that time. 76 </p> 77 <p> 78 The <code class="methodname">DB_ENV->rep_set_clockskew()</code> method configures a database 79 environment, not only operations performed using the specified 80 <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a> handle. 81 </p> 82 <p> 83 The <code class="methodname">DB_ENV->rep_set_clockskew()</code> method may not be called after the 84 <a class="xref" href="repmgrstart.html" title="DB_ENV->repmgr_start()">DB_ENV->repmgr_start()</a> or 85 <a class="xref" href="repstart.html" title="DB_ENV->rep_start()">DB_ENV->rep_start()</a> 86 methods are called. 87 </p> 88 <p> 89 The <code class="methodname">DB_ENV->rep_set_clockskew()</code> <span> 90 <span> 91 method returns a non-zero error value on failure and 0 on success. 92 </span> 93 94 </span> 95 </p> 96 <div class="sect2" lang="en" xml:lang="en"> 97 <div class="titlepage"> 98 <div> 99 <div> 100 <h3 class="title"><a id="id1698285"></a>Parameters</h3> 101 </div> 102 </div> 103 </div> 104 <div class="sect3" lang="en" xml:lang="en"> 105 <div class="titlepage"> 106 <div> 107 <div> 108 <h4 class="title"><a id="id1698291"></a>fast_clock</h4> 109 </div> 110 </div> 111 </div> 112 <p> 113 The value, relative to the <span class="bold"><strong>slow_clock</strong></span>, 114 of the fastest clock in the group of sites. 115 </p> 116 </div> 117 <div class="sect3" lang="en" xml:lang="en"> 118 <div class="titlepage"> 119 <div> 120 <div> 121 <h4 class="title"><a id="id1698364"></a>slow_clock</h4> 122 </div> 123 </div> 124 </div> 125 <p> 126 The value of the slowest clock in the group of sites. 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="id1698281"></a>Errors</h3> 135 </div> 136 </div> 137 </div> 138 <p> 139 The <code class="methodname">DB_ENV->rep_set_clockskew()</code> <span> 140 <span> 141 method may fail and return one of the following non-zero errors: 142 </span> 143 144 </span> 145 </p> 146 <div class="sect3" lang="en" xml:lang="en"> 147 <div class="titlepage"> 148 <div> 149 <div> 150 <h4 class="title"><a id="id1698376"></a>EINVAL</h4> 151 </div> 152 </div> 153 </div> 154 <p> 155 If the method was called after replication is started 156with a call to the <a class="xref" href="repmgrstart.html" title="DB_ENV->repmgr_start()">DB_ENV->repmgr_start()</a> or 157the <a class="xref" href="repstart.html" title="DB_ENV->rep_start()">DB_ENV->rep_start()</a> method; 158 or if an invalid flag value or parameter was specified. 159 </p> 160 </div> 161 </div> 162 <div class="sect2" lang="en" xml:lang="en"> 163 <div class="titlepage"> 164 <div> 165 <div> 166 <h3 class="title"><a id="id1698324"></a>Class</h3> 167 </div> 168 </div> 169 </div> 170 <p> 171 <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a> 172 </p> 173 </div> 174 <div class="sect2" lang="en" xml:lang="en"> 175 <div class="titlepage"> 176 <div> 177 <div> 178 <h3 class="title"><a id="id1698387"></a>See Also</h3> 179 </div> 180 </div> 181 </div> 182 <p> 183 <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a> 184 </p> 185 </div> 186 </div> 187 <div class="navfooter"> 188 <hr /> 189 <table width="100%" summary="Navigation footer"> 190 <tr> 191 <td width="40%" align="left"><a accesskey="p" href="repmessage.html">Prev</a>��</td> 192 <td width="20%" align="center"> 193 <a accesskey="u" href="rep.html">Up</a> 194 </td> 195 <td width="40%" align="right">��<a accesskey="n" href="repconfig.html">Next</a></td> 196 </tr> 197 <tr> 198 <td width="40%" align="left" valign="top">DB_ENV->rep_process_message()��</td> 199 <td width="20%" align="center"> 200 <a accesskey="h" href="index.html">Home</a> 201 </td> 202 <td width="40%" align="right" valign="top">��DB_ENV->rep_set_config()</td> 203 </tr> 204 </table> 205 </div> 206 </body> 207</html> 208