FOOO Berkeley DB: DbEnv::rep_set_clockskew
DbEnv::rep_set_clockskew API Ref

#include <db_cxx.h>

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

DbEnv::rep_get_clockskew(u_int32_t *fast_clockp, u_in32_t *slow_clockp);


Description: DbEnv::rep_set_clockskew

The DbEnv::rep_set_clockskew method sets the clock skew ratio among replication group members based on the fastest and slowest measurements among the group for use with master leases. Calling this method is optional, the default values for clock skew assume no skew. The user must also configure leases via the DbEnv::rep_set_config method. Additionally, the user must also set the master lease timeout via the DbEnv::rep_set_timeout method and 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. For a description of master leases, see Master leases.

These arguments can be used to express either raw measurements of a clock timing experiment or a percentage across machines. For instance a group of sites have a 2% variance, then fast_clock should be given as 102, and slow_clock should be set at 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 slow_clock

Errors

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


EINVAL

Description: DbEnv::rep_get_clockskew

The DbEnv::rep_get_clockskew method returns the current clock skew values.

The DbEnv::rep_get_clockskew method may be called at any time during the life of the application.

The DbEnv::rep_get_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_clockp slow_clockp


Class DbEnv
See Also Replication and Related Methods

APIRef

Copyright (c) 1996,2008 Oracle. All rights reserved.