Imported Upstream version 5.3.21
[platform/upstream/libdb.git] / docs / api_reference / CXX / repclockskew.html
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 xmlns="" class="navheader">
16       <div class="libver">
17         <p>Library Version 11.2.5.3</p>
18       </div>
19       <table width="100%" summary="Navigation header">
20         <tr>
21           <th colspan="3" align="center">DbEnv::rep_set_clockskew()</th>
22         </tr>
23         <tr>
24           <td width="20%" align="left"><a accesskey="p" href="repmessage.html">Prev</a> </td>
25           <th width="60%" align="center">Chapter 11. 
26                 Replication Methods
27         </th>
28           <td width="20%" align="right"> <a accesskey="n" href="repconfig.html">Next</a></td>
29         </tr>
30       </table>
31       <hr />
32     </div>
33     <div class="sect1" lang="en" xml:lang="en">
34       <div class="titlepage">
35         <div>
36           <div>
37             <h2 class="title" style="clear: both"><a id="repclockskew"></a>DbEnv::rep_set_clockskew()</h2>
38           </div>
39         </div>
40       </div>
41       <pre class="programlisting">#include &lt;db_cxx.h&gt;
42
43 int
44 DbEnv::rep_set_clockskew(u_int32_t fast_clock, u_int32_t slow_clock); </pre>
45       <p>
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
53          via the 
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
62          master leases, see 
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>.
65     </p>
66       <p>
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.
72     </p>
73       <p>
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.
82     </p>
83       <p>
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.
87     </p>
88       <p>
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> 
92          methods are called.
93     </p>
94       <p>
95          The <code class="methodname">DbEnv::rep_set_clockskew()</code> <span>
96             
97             <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.
101             </span>
102         </span>
103     </p>
104       <div class="sect2" lang="en" xml:lang="en">
105         <div class="titlepage">
106           <div>
107             <div>
108               <h3 class="title"><a id="idp4200632"></a>Parameters</h3>
109             </div>
110           </div>
111         </div>
112         <div class="sect3" lang="en" xml:lang="en">
113           <div class="titlepage">
114             <div>
115               <div>
116                 <h4 class="title"><a id="idp4200368"></a>fast_clock</h4>
117               </div>
118             </div>
119           </div>
120           <p>
121                  The value, relative to the <span class="bold"><strong>slow_clock</strong></span>, 
122                  of the fastest clock in the group of sites.
123              </p>
124         </div>
125         <div class="sect3" lang="en" xml:lang="en">
126           <div class="titlepage">
127             <div>
128               <div>
129                 <h4 class="title"><a id="idp4194728"></a>slow_clock</h4>
130               </div>
131             </div>
132           </div>
133           <p>
134                   The value of the slowest clock in the group of sites.
135              </p>
136         </div>
137       </div>
138       <div class="sect2" lang="en" xml:lang="en">
139         <div class="titlepage">
140           <div>
141             <div>
142               <h3 class="title"><a id="idp4165112"></a>Errors</h3>
143             </div>
144           </div>
145         </div>
146         <p>
147              The <code class="methodname">DbEnv::rep_set_clockskew()</code> <span>
148             
149             <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:
153             </span>
154         </span>
155         </p>
156         <div class="sect3" lang="en" xml:lang="en">
157           <div class="titlepage">
158             <div>
159               <div>
160                 <h4 class="title"><a id="idp4213480"></a>EINVAL</h4>
161               </div>
162             </div>
163           </div>
164           <p>
165                 If the method was called after replication is started with a
166                 call to the 
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.
170             </p>
171         </div>
172       </div>
173       <div class="sect2" lang="en" xml:lang="en">
174         <div class="titlepage">
175           <div>
176             <div>
177               <h3 class="title"><a id="idp4211424"></a>Class</h3>
178             </div>
179           </div>
180         </div>
181         <p>
182                 <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>  
183             </p>
184       </div>
185       <div class="sect2" lang="en" xml:lang="en">
186         <div class="titlepage">
187           <div>
188             <div>
189               <h3 class="title"><a id="idp4201064"></a>See Also</h3>
190             </div>
191           </div>
192         </div>
193         <p>
194              <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a> 
195         </p>
196       </div>
197     </div>
198     <div class="navfooter">
199       <hr />
200       <table width="100%" summary="Navigation footer">
201         <tr>
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>
205           </td>
206           <td width="40%" align="right"> <a accesskey="n" href="repconfig.html">Next</a></td>
207         </tr>
208         <tr>
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>
212           </td>
213           <td width="40%" align="right" valign="top"> DbEnv::rep_set_config()</td>
214         </tr>
215       </table>
216     </div>
217   </body>
218 </html>