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: DB_ENV-&gt;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>DB_ENV-&gt;rep_set_clockskew</b>
15</td>
16<td align=right>
17<a href="../api_c/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.h&gt;
24<p>
25int
26DB_ENV-&gt;rep_set_clockskew(DB_ENV *env,
27    u_int32_t fast_clock, u_int32_t slow_clock);
28<p>
29int
30DB_ENV-&gt;rep_get_clockskew(DB_ENV *env,
31    u_int32_t *fast_clockp, u_int32_t *slow_clockp);
32</pre></b>
33<hr size=1 noshade>
34<b>Description: DB_ENV-&gt;rep_set_clockskew</b>
35<p>The DB_ENV-&gt;rep_set_clockskew method sets the clock skew ratio among
36replication group members based on the fastest and slowest measurements
37among the group for use with master leases.  Calling this method is
38optional, the default values for clock skew assume no skew.  The user
39must also configure leases via the <a href="../api_c/rep_config.html">DB_ENV-&gt;rep_set_config</a> method.
40Additionally, the user must also set the master lease timeout via the
41<a href="../api_c/rep_timeout.html">DB_ENV-&gt;rep_set_timeout</a> method and the number of sites in the replication
42group via the <a href="../api_c/rep_nsites.html">DB_ENV-&gt;rep_set_nsites</a> method.  These methods may be called in
43any order.  For a description of the clock skew values, see
44<a href="../ref/rep/clock_skew.html">Clock skew</a>.  For a description
45of master leases, see <a href="../ref/rep/lease.html">Master
46leases</a>.</p>
47<p>These arguments can be used to express either raw measurements of a
48clock timing experiment or a percentage across machines.  For instance
49a group of sites have a 2% variance, then <b>fast_clock</b> should be
50given as 102, and <b>slow_clock</b> should be set at 100.  Or, for a
510.03% difference, you can use 10003 and 10000 respectively.</p>
52<p>The database environment's replication subsystem may also be configured using the
53environment's <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file.  The syntax of the entry in that
54file is a single line with the string "rep_set_clockskew", one or more whitespace
55characters, and the clockskew specified in two parts: the fast_clock and the slow_clock.
56For example, "rep_set_clockskew 102 100".
57Because the <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment
58is opened, it will silently overrule configuration done before that
59time.</p>
60<p>The DB_ENV-&gt;rep_set_clockskew method configures a database environment, not only operations
61performed using the specified <a href="../api_c/env_class.html">DB_ENV</a> handle.</p>
62<p>The DB_ENV-&gt;rep_set_clockskew method may not be called after the <a href="../api_c/repmgr_start.html">DB_ENV-&gt;repmgr_start</a> or <a href="../api_c/rep_start.html">DB_ENV-&gt;rep_start</a> methods are
63called.</p>
64<p>The DB_ENV-&gt;rep_set_clockskew method
65returns a non-zero error value on failure
66and 0 on success.
67</p>
68<b>Parameters</b> <br>
69 <b>fast_clock</b><ul compact><li>The value, relative to the <b>slow_clock</b>, of the fastest clock
70in the group of sites.</ul>
71 <b>slow_clock</b><ul compact><li>The value of the slowest clock in the group of sites.</ul>
72<br>
73<br><b>Errors</b>
74<p>The DB_ENV-&gt;rep_set_clockskew method
75may fail and return one of the following non-zero errors:</p>
76<br>
77<b>EINVAL</b><ul compact><li>An
78invalid flag value or parameter was specified.</ul>
79<br>
80<hr size=1 noshade>
81<b>Description: DB_ENV-&gt;rep_get_clockskew</b>
82<p>The DB_ENV-&gt;rep_get_clockskew method returns the current clock skew values.</p>
83<p>The DB_ENV-&gt;rep_get_clockskew method may be called at any time during the life of the
84application.</p>
85<p>The DB_ENV-&gt;rep_get_clockskew method
86returns a non-zero error value on failure
87and 0 on success.
88</p>
89<b>Parameters</b> <br>
90 <b>fast_clockp</b><ul compact><li>The <b>fast_clockp</b> parameter references memory into which
91 the value for the fastest clock in the group of sites is copied.</ul> 
92 <b>slow_clockp</b><ul compact><li>The <b>slow_clockp</b> parameter references memory into which
93 the value for the slowest clock in the group of sites is copied.</ul> 
94<br>
95<hr size=1 noshade>
96<br><b>Class</b>
97<a href="../api_c/env_class.html">DB_ENV</a>
98<br><b>See Also</b>
99<a href="../api_c/rep_list.html">Replication and Related Methods</a>
100</tt>
101<table width="100%"><tr><td><br></td><td align=right>
102<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
103</td></tr></table>
104<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
105</body>
106</html>
107