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