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