DB_ENV->rep_process_message()

#include <db.h>

int
DB_ENV->rep_process_message(DB_ENV *env,
    DBT *control, DBT *rec, int envid, DB_LSN *ret_lsnp)  

The DB_ENV->rep_process_message() method processes an incoming replication message sent by a member of the replication group to the local database environment.

The DB_ENV->rep_process_message() 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.

For implementation reasons, all incoming replication messages must be processed using the same DB_ENV handle. It is not required that a single thread of control process all messages, only that all threads of control processing messages use the same handle.

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_process_message() method has additional return values:

Unless otherwise specified, the DB_ENV->rep_process_message() method returns a non-zero error value on failure and 0 on success.

Parameters

control

The control parameter should reference a copy of the control parameter specified by Berkeley DB on the sending environment. See the DB_ENV->rep_set_transport() method for more information.

envid

The envid parameter should contain the local identifier that corresponds to the environment that sent the message to be processed (see Replication environment IDs for more information).

rec

The rec parameter should reference a copy of the rec parameter specified by Berkeley DB on the sending environment. See the DB_ENV->rep_set_transport() method for more information.

ret_lsnp

If DB_ENV->rep_process_message() method returns DB_REP_NOTPERM then the ret_lsnp parameter will contain the log sequence number of this permanent log message that could not be written to disk. If DB_ENV->rep_process_message() method returns DB_REP_ISPERM then the ret_lsnp parameter will contain largest log sequence number of the permanent records that are now written to disk as a result of processing this message. In all other cases the value of ret_lsnp is undefined.

Errors

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

EINVAL

If the database environment was not already configured to communicate with a replication group by a call to DB_ENV->rep_set_transport(); if the database environment was not already opened; if this method is called from a Replication Manager application; or if an invalid flag value or parameter was specified.

Class

DB_ENV

See Also

Replication and Related Methods