Library Version 12.1.6.1

DB_ENV->rep_sync()
Prev | Chapter 10. Replication Methods | Next

## DB_ENV->rep_sync()

    #include <db.h>

    int
    DB_ENV->rep_sync(DB_ENV *env, u_int32_t flags);

The `DB_ENV->rep_sync()` method forces master synchronization to begin for this client. This method is the other half of setting the DB_REP_CONF_DELAYCLIENT flag via the DB_ENV->rep_set_config() method.

If an application has configured delayed master synchronization, the application must synchronize explicitly (otherwise the client will remain out-of-date and will ignore all database changes forwarded from the replication group master). The `DB_ENV->rep_sync()` method may be called any time after the client application learns that the new master has been established (by receiving a DB_EVENT_REP_NEWMASTER event notification).

Before calling this method, 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.

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

### Parameters

#### flags

The flags parameter is currently unused, and must be set to 0.

### Errors

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

#### DB_REP_JOIN_FAILURE

If master synchronization requires an internal initialization but automatic internal initializations have been disabled by setting the DB_REP_CONF_AUTOINIT flag to `0`.

#### EINVAL

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; or if an invalid flag value or parameter was specified.

### Class

DB_ENV

### See Also

Replication and Related Methods

Prev | Up | Next
DB_ENV->rep_stat_print() | Home | DB_ENV->repmgr_channel()