### 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)

### Description: DB_ENV->rep_process_message

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.

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.

The DB_ENV->rep_process_message method has additional return values:

DB_REP_DUPMASTER

  The DB_ENV->rep_process_message method will return DB_REP_DUPMASTER if the replication group has more than one master. The application should reconfigure itself as a client by calling the DB_ENV->rep_start method, and then call for an election by calling DB_ENV->rep_elect.

DB_REP_HOLDELECTION

  The DB_ENV->rep_process_message method will return DB_REP_HOLDELECTION if an election is needed. The application should call for an election by calling DB_ENV->rep_elect.

DB_REP_ISPERM

  The DB_ENV->rep_process_message method will return DB_REP_ISPERM if processing this message results in the processing of records that are permanent. The maximum LSN of the permanent records stored is returned.

DB_REP_NEWMASTER

  The DB_ENV->rep_process_message method will return DB_REP_NEWMASTER if a new master has been elected. The envid parameter contains the environment ID of the new master. If the recipient of this error return has been made master, it is the application's responsibility to begin acting as the master environment.

DB_REP_NEWSITE

  The DB_ENV->rep_process_message method will return DB_REP_NEWSITE if the system received contact information from a new environment. The rec parameter contains the opaque data specified in the cdata parameter to the DB_ENV->rep_start. The application should take whatever action is needed to establish a communication channel with this new environment.

DB_REP_NOTPERM

  The DB_ENV->rep_process_message method will return DB_REP_NOTPERM if a message carrying a DB_REP_PERMANENT flag was processed successfully, but was not written to disk. The LSN of this record is returned. The application should take whatever action is deemed necessary to retain its recoverability characteristics.

DB_REP_STARTUPDONE

  The DB_ENV->rep_process_message method will return DB_REP_STARTUPDONE if the system detects that a client completed startup synchronization. The client application knows that this client is now processing live log records received from the master.

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.
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.
ret_lsn
  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.

### Class

DB_ENV

### See Also

Replication and Related Methods`

Copyright (c) 1996-2004 Sleepycat Software, Inc. - All rights reserved.