#include <db.h>

DB_ENV->rep_start(DB_ENV *env, DBT *cdata, u_int32_t flags);  

The DB_ENV->rep_start() method configures the database environment as a client or master in a group of replicated database environments.

The DB_ENV->rep_start() method is not called by most replication applications. It should only be called by Base API applications implementing their own network transport layer, explicitly holding replication group elections and handling replication messages outside of the Replication Manager framework.

Replication master environments are the only database environments where replicated databases may be modified. Replication client environments are read-only as long as they are clients. Replication client environments may be upgraded to be replication master environments in the case that the current master fails or there is no master present. Replication view environments are always read-only and can never become master environments. If master leases are in use, this method cannot be used to appoint a master, and should only be used to configure a database environment as a master as the result of an election.

The enclosing database environment must already have been opened by calling the DB_ENV->open() method and must already have been configured to send replication messages by calling the DB_ENV->rep_set_transport() method. If you are starting a view, you must have called the DB_ENV->rep_set_view() method before opening the enclosing database environment.

The DB_ENV->rep_start() method returns a non-zero error value on failure and 0 on success.



The cdata parameter is an opaque data item that is sent over the communication infrastructure when the client comes online (see Connecting to a new site for more information). If no such information is useful, cdata should be NULL.


The flags parameter must be set to one of the following values:


    Configure the environment as a replication client or view.


    Configure the environment as a replication master.


The DB_ENV->rep_start() method may fail and return one of the following non-zero errors:


If the flags parameter was passed as DB_REP_MASTER but the database environment cannot currently become the replication master because it is temporarily initializing and is incomplete.


If the database environment was not already configured to communicate with a replication group by a call to DB_ENV->rep_set_transport() ; the database environment was not already opened; this method is called from a Replication Manager application; outstanding master leases are granted; this method is used to appoint a new master when master leases are in use; a view is being started without having called the DB_ENV->rep_set_view() method before opening the database environment; or if an invalid flag value or parameter was specified.



See Also

Replication and Related Methods