1<!--$Id: rep_clockskew.so,v 1.12 2008/02/01 18:53:41 bostic Exp $-->
2FOOO
3<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
4<!--See the file LICENSE for redistribution information.-->
5<html>
6<head>
7<title>Berkeley DB: DbEnv::rep_set_clockskew</title>
8<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
9<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
10</head>
11<body bgcolor=white>
12<table width="100%"><tr valign=top>
13<td>
14<b>DbEnv::rep_set_clockskew</b>
15</td>
16<td align=right>
17<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a>
18<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
19</tr></table>
20<hr size=1 noshade>
21<tt>
22<b><pre>
23#include &lt;db_cxx.h&gt;
24<p>
25int
26DbEnv::rep_set_clockskew(u_int32_t fast_clock, u_int32_t slow_clock);
27<p>
28DbEnv::rep_get_clockskew(u_int32_t *fast_clockp, u_in32_t *slow_clockp);
29</pre></b>
30<hr size=1 noshade>
31<b>Description: DbEnv::rep_set_clockskew</b>
32<p>The DbEnv::rep_set_clockskew method sets the clock skew ratio among
33replication group members based on the fastest and slowest measurements
34among the group for use with master leases.  Calling this method is
35optional, the default values for clock skew assume no skew.  The user
36must also configure leases via the <a href="../api_cxx/rep_config.html">DbEnv::rep_set_config</a> method.
37Additionally, the user must also set the master lease timeout via the
38<a href="../api_cxx/rep_timeout.html">DbEnv::rep_set_timeout</a> method and the number of sites in the replication
39group via the <a href="../api_cxx/rep_nsites.html">DbEnv::rep_set_nsites</a> method.  These methods may be called in
40any order.  For a description of the clock skew values, see
41<a href="../ref/rep/clock_skew.html">Clock skew</a>.  For a description
42of master leases, see <a href="../ref/rep/lease.html">Master
43leases</a>.</p>
44<p>These arguments can be used to express either raw measurements of a
45clock timing experiment or a percentage across machines.  For instance
46a group of sites have a 2% variance, then <b>fast_clock</b> should be
47given as 102, and <b>slow_clock</b> should be set at 100.  Or, for a
480.03% difference, you can use 10003 and 10000 respectively.</p>
49<p>The database environment's replication subsystem may also be configured using the
50environment's <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file.  The syntax of the entry in that
51file is a single line with the string "rep_set_clockskew", one or more whitespace
52characters, and the clockskew specified in two parts: the fast_clock and the slow_clock.
53For example, "rep_set_clockskew 102 100".
54Because the <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment
55is opened, it will silently overrule configuration done before that
56time.</p>
57<p>The DbEnv::rep_set_clockskew method configures a database environment, not only operations
58performed using the specified <a href="../api_cxx/env_class.html">DbEnv</a> handle.</p>
59<p>The DbEnv::rep_set_clockskew method may not be called after the <a href="../api_cxx/repmgr_start.html">DbEnv::repmgr_start</a> or <a href="../api_cxx/rep_start.html">DbEnv::rep_start</a> methods are
60called.</p>
61<p>The DbEnv::rep_set_clockskew method
62either returns a non-zero error value
63or throws an exception that encapsulates a non-zero error value on
64failure, and returns 0 on success.
65</p>
66<b>Parameters</b> <br>
67 <b>fast_clock</b><ul compact><li>The value, relative to the <b>slow_clock</b>, of the fastest clock
68in the group of sites.</ul>
69 <b>slow_clock</b><ul compact><li>The value of the slowest clock in the group of sites.</ul>
70<br>
71<br><b>Errors</b>
72<p>The DbEnv::rep_set_clockskew method
73may fail and throw
74<a href="../api_cxx/except_class.html">DbException</a>,
75encapsulating one of the following non-zero errors, or return one of
76the following non-zero errors:</p>
77<br>
78<b>EINVAL</b><ul compact><li>An
79invalid flag value or parameter was specified.</ul>
80<br>
81<hr size=1 noshade>
82<b>Description: DbEnv::rep_get_clockskew</b>
83<p>The DbEnv::rep_get_clockskew method returns the current clock skew values.</p>
84<p>The DbEnv::rep_get_clockskew method may be called at any time during the life of the
85application.</p>
86<p>The DbEnv::rep_get_clockskew method
87either returns a non-zero error value
88or throws an exception that encapsulates a non-zero error value on
89failure, and returns 0 on success.
90</p>
91<b>Parameters</b> <br>
92 <b>fast_clockp</b><ul compact><li>The <b>fast_clockp</b> parameter references memory into which
93 the value for the fastest clock in the group of sites is copied.</ul> 
94 <b>slow_clockp</b><ul compact><li>The <b>slow_clockp</b> parameter references memory into which
95 the value for the slowest clock in the group of sites is copied.</ul> 
96<br>
97<hr size=1 noshade>
98<br><b>Class</b>
99<a href="../api_cxx/env_class.html">DbEnv</a>
100<br><b>See Also</b>
101<a href="../api_cxx/rep_list.html">Replication and Related Methods</a>
102</tt>
103<table width="100%"><tr><td><br></td><td align=right>
104<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
105</td></tr></table>
106<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
107</body>
108</html>
109