Base API methods

Base API applications use the following Berkeley DB methods.

DB_ENV->rep_set_transport()

The DB_ENV->rep_set_transport() method configures the replication system’s communications infrastructure.

DB_ENV->rep_start()

The DB_ENV->rep_start() method configures (or reconfigures) an existing database environment to be a replication master or client.

DB_ENV->rep_process_message()

The DB_ENV->rep_process_message() method is used to process incoming messages from other environments in the replication group. For clients, it is responsible for accepting log records and updating the local databases based on messages from the master. For both the master and the clients, it is responsible for handling administrative functions (for example, the protocol for dealing with lost messages), and permitting new clients to join an active replication group. This method should only be called after the replication system’s communications infrastructure has been configured via DB_ENV->rep_set_transport().

DB_ENV->rep_elect()

The DB_ENV->rep_elect() method causes the replication group to elect a new master; it is called whenever contact with the master is lost and the application wants the remaining sites to select a new master.

DB_ENV->set_event_notify()

The DB_ENV->set_event_notify() method is needed for applications to discover important replication-related events, such as the result of an election and appointment of a new master.

DB_ENV->rep_set_priority()

The DB_ENV->rep_set_priority() method configures the local site’s priority for the purpose of elections.

DB_ENV->rep_set_timeout()

This method optionally configures various timeout values. Otherwise default timeout values as specified in DB_ENV->rep_set_timeout() are used.

DB_ENV->rep_set_limit()

The DB_ENV->rep_set_limit() method imposes an upper bound on the amount of data that will be sent in response to a single call to DB_ENV->rep_process_message(). During client recovery, that is, when a replica site is trying to synchronize with the master, clients may ask the master for a large number of log records. If it is going to harm an application for the master message loop to remain busy for an extended period transmitting records to the replica, then the application will want to use DB_ENV->rep_set_limit() to limit the amount of data the master will send before relinquishing control and accepting other messages.

DB_ENV->rep_set_request()

This method sets a threshold for the minimum and maximum time that a client waits before requesting retransmission of a missing message.

Base API applications may configure one or more view sites. A view is a full or partial copy of the replicated data that does not otherwise participate in the replication group. For more information, see Replication views.

In addition to the methods previously described, Base API applications may also call the following methods, as needed: DB_ENV->rep_stat(), DB_ENV->rep_sync() and DB_ENV->rep_set_config()