Library Version 12.1.6.2

DbEnv::rep_set_clockskew()
Prev | Chapter 11. Replication Methods | Next

## DbEnv::rep_set_clockskew()

    #include <db_cxx.h>

    int
    DbEnv::rep_set_clockskew(u_int32_t fast_clock, u_int32_t slow_clock);

The `DbEnv::rep_set_clockskew()` method sets the clock skew ratio among replication group members based on the fastest and slowest clock measurements among the group for use with master leases. Calling this method is optional; the default values for clock skew assume no skew. The application must also configure leases via the DbEnv::rep_set_config() method and set the master lease timeout via the DbEnv::rep_set_timeout() method. Base API applications must also set the number of sites in the replication group via the DbEnv::rep_set_nsites() method. These methods may be called in any order. For a description of the clock skew values, see Clock skew in the Berkeley DB Programmer's Reference Guide. For a description of master leases, see Master leases in the Berkeley DB Programmer's Reference Guide.

These arguments can be used to express either raw measurements of a clock timing experiment or a percentage across machines. For example, if a group of sites has a 2% variance, then fast_clock should be set to 102, and slow_clock should be set to 100. Or, for a 0.03% difference, you can use 10003 and 10000 respectively.

The database environment's replication subsystem may also be configured using the environment's DB_CONFIG file. The syntax of the entry in that file is a single line with the string "rep_set_clockskew", one or more whitespace characters, and the clockskew specified in two parts: the fast_clock and the slow_clock. For example, "rep_set_clockskew 102 100". Because the DB_CONFIG file is read when the database environment is opened, it will silently overrule configuration done before that time.

The `DbEnv::rep_set_clockskew()` method configures a database environment, not only operations performed using the specified DbEnv handle.

The `DbEnv::rep_set_clockskew()` method may not be called after the DbEnv::repmgr_start() or DbEnv::rep_start() methods are called.

The `DbEnv::rep_set_clockskew()` method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 0 on success.

### Parameters

#### fast_clock

The value, relative to the slow_clock, of the fastest clock in the group of sites.

#### slow_clock

The value of the slowest clock in the group of sites.

### Errors

The `DbEnv::rep_set_clockskew()` method may fail and throw a DbException exception, encapsulating one of the following non-zero errors, or return one of the following non-zero errors:

#### EINVAL

If the method was called after replication is started with a call to the DbEnv::repmgr_start() or the DbEnv::rep_start() method; or if an invalid flag value or parameter was specified.

### Class

DbEnv

### See Also

Replication and Related Methods

Prev | Up | Next
DbEnv::rep_process_message() | Home | DbEnv::rep_set_config()