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">
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()" />
15 <div xmlns="" class="navheader">
17 <p>Library Version 11.2.5.3</p>
19 <table width="100%" summary="Navigation header">
21 <th colspan="3" align="center">DbEnv::rep_set_clockskew()</th>
24 <td width="20%" align="left"><a accesskey="p" href="repmessage.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 11.
28 <td width="20%" align="right"> <a accesskey="n" href="repconfig.html">Next</a></td>
33 <div class="sect1" lang="en" xml:lang="en">
34 <div class="titlepage">
37 <h2 class="title" style="clear: both"><a id="repclockskew"></a>DbEnv::rep_set_clockskew()</h2>
41 <pre class="programlisting">#include <db_cxx.h>
44 DbEnv::rep_set_clockskew(u_int32_t fast_clock, u_int32_t slow_clock); </pre>
46 The <code class="methodname">DbEnv::rep_set_clockskew()</code> method sets the
47 clock skew ratio among replication group members based on the fastest
48 and slowest measurements among the group for use with master leases.
49 Calling this method is optional; the default values for clock skew
50 assume no skew. The user must also configure leases via the
51 <a class="xref" href="repconfig.html" title="DbEnv::rep_set_config()">DbEnv::rep_set_config()</a>
52 method. Additionally, the user must also set the master lease timeout
54 <a class="xref" href="repset_timeout.html" title="DbEnv::rep_set_timeout()">DbEnv::rep_set_timeout()</a>
55 method. For Base API applications, the user must also set the number of
56 sites in the replication group via the
57 <a class="xref" href="repnsites.html" title="DbEnv::rep_set_nsites()">DbEnv::rep_set_nsites()</a>
58 method. These methods may be called in any order. For a description
59 of the clock skew values, see
60 <a href="../../programmer_reference/rep_clock_skew.html" class="olink">Clock skew</a>
61 in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>. For a description of
63 <a href="../../programmer_reference/rep_lease.html" class="olink">Master leases</a> in the
64 <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>.
67 These arguments can be used to express either raw measurements of a
68 clock timing experiment or a percentage across machines. For example, if
69 a group of sites has a 2% variance, then <span class="bold"><strong>fast_clock</strong></span> should be set to 102, and
70 <span class="bold"><strong>slow_clock</strong></span> should be set to 100. Or,
71 for a 0.03% difference, you can use 10003 and 10000 respectively.
74 The database environment's replication subsystem may also be
75 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 syntax of
76 the entry in that file is a single line with the string
77 "rep_set_clockskew", one or more whitespace characters, and the
78 clockskew specified in two parts: the fast_clock and the
79 slow_clock. For example, "rep_set_clockskew 102 100". Because the
80 <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is read when the database environment is opened,
81 it will silently overrule configuration done before that time.
84 The <code class="methodname">DbEnv::rep_set_clockskew()</code> method configures a database
85 environment, not only operations performed using the specified
86 <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> handle.
89 The <code class="methodname">DbEnv::rep_set_clockskew()</code> method may not be called after the
90 <a class="xref" href="repmgrstart.html" title="DbEnv::repmgr_start()">DbEnv::repmgr_start()</a> or
91 <a class="xref" href="repstart.html" title="DbEnv::rep_start()">DbEnv::rep_start()</a>
95 The <code class="methodname">DbEnv::rep_set_clockskew()</code> <span>
98 method either returns a non-zero error value or throws an
99 exception that encapsulates a non-zero error value on
100 failure, and returns 0 on success.
104 <div class="sect2" lang="en" xml:lang="en">
105 <div class="titlepage">
108 <h3 class="title"><a id="idp4200632"></a>Parameters</h3>
112 <div class="sect3" lang="en" xml:lang="en">
113 <div class="titlepage">
116 <h4 class="title"><a id="idp4200368"></a>fast_clock</h4>
121 The value, relative to the <span class="bold"><strong>slow_clock</strong></span>,
122 of the fastest clock in the group of sites.
125 <div class="sect3" lang="en" xml:lang="en">
126 <div class="titlepage">
129 <h4 class="title"><a id="idp4194728"></a>slow_clock</h4>
134 The value of the slowest clock in the group of sites.
138 <div class="sect2" lang="en" xml:lang="en">
139 <div class="titlepage">
142 <h3 class="title"><a id="idp4165112"></a>Errors</h3>
147 The <code class="methodname">DbEnv::rep_set_clockskew()</code> <span>
150 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a>
151 exception, encapsulating one of the following non-zero errors, or return one
152 of the following non-zero errors:
156 <div class="sect3" lang="en" xml:lang="en">
157 <div class="titlepage">
160 <h4 class="title"><a id="idp4213480"></a>EINVAL</h4>
165 If the method was called after replication is started with a
167 <a class="xref" href="repmgrstart.html" title="DbEnv::repmgr_start()">DbEnv::repmgr_start()</a> or the
168 <a class="xref" href="repstart.html" title="DbEnv::rep_start()">DbEnv::rep_start()</a> method; or if
169 an invalid flag value or parameter was specified.
173 <div class="sect2" lang="en" xml:lang="en">
174 <div class="titlepage">
177 <h3 class="title"><a id="idp4211424"></a>Class</h3>
182 <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a>
185 <div class="sect2" lang="en" xml:lang="en">
186 <div class="titlepage">
189 <h3 class="title"><a id="idp4201064"></a>See Also</h3>
194 <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a>
198 <div class="navfooter">
200 <table width="100%" summary="Navigation footer">
202 <td width="40%" align="left"><a accesskey="p" href="repmessage.html">Prev</a> </td>
203 <td width="20%" align="center">
204 <a accesskey="u" href="rep.html">Up</a>
206 <td width="40%" align="right"> <a accesskey="n" href="repconfig.html">Next</a></td>
209 <td width="40%" align="left" valign="top">DbEnv::rep_process_message() </td>
210 <td width="20%" align="center">
211 <a accesskey="h" href="index.html">Home</a>
213 <td width="40%" align="right" valign="top"> DbEnv::rep_set_config()</td>