<!--$Id: rep_message.so,v 1.39 2007/03/20 20:20:26 alanb Exp $--> <!--Copyright (c) 1997,2007 Oracle. All rights reserved.--> <!--See the file LICENSE for redistribution information.--> <html> <head> <title>Berkeley DB: DB_ENV->rep_process_message</title> <meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> <meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> </head> <body bgcolor=white> <table width="100%"><tr valign=top> <td> <h3>DB_ENV->rep_process_message</h3> </td> <td align=right> <a href="../../db46-devel-4.6.21/api_c/api_core.html"><img src="../../db46-devel-4.6.21/images/api.gif" alt="API"></a> <a href="../../db46-devel-4.6.21/ref/toc.html"><img src="../../db46-devel-4.6.21/images/ref.gif" alt="Ref"></a></td> </tr></table> <hr size=1 noshade> <tt> <h3><pre> #include <db.h> <p> int DB_ENV->rep_process_message(DB_ENV *env, DBT *control, DBT *rec, int envid, DB_LSN *ret_lsnp) </pre></h3> <hr size=1 noshade> <h3>Description: DB_ENV->rep_process_message</h3> <p>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.</p> <p>The DB_ENV->rep_process_message method is not called by most replication applications. It should only be called by applications implementing their own network transport layer, explicitly holding replication group elections and handling replication messages outside of the replication manager framework.</p> <p>For implementation reasons, all incoming replication messages must be processed using the same <a href="../../db46-devel-4.6.21/api_c/env_class.html">DB_ENV</a> 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.</p> <p>The DB_ENV->rep_process_message method has additional return values:</p> <dl compact> <dt><a name="DB_REP_DUPMASTER">DB_REP_DUPMASTER</a><dd> <p>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 <a href="../../db46-devel-4.6.21/api_c/rep_start.html">DB_ENV->rep_start</a> method, and then call for an election by calling <a href="../../db46-devel-4.6.21/api_c/rep_elect.html">DB_ENV->rep_elect</a>. </p> <dt><a name="DB_REP_HOLDELECTION">DB_REP_HOLDELECTION</a><dd> <p>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 <a href="../../db46-devel-4.6.21/api_c/rep_elect.html">DB_ENV->rep_elect</a>. </p> <dt><a name="DB_REP_IGNORE">DB_REP_IGNORE</a><dd> <p>The DB_ENV->rep_process_message method will return DB_REP_IGNORE if this message cannot be processed. This is an indication that this message is irrelevant to the current replication state (for example, an old message from a previous generation arrives and is processed late). </p> <dt><a name="DB_REP_ISPERM">DB_REP_ISPERM</a><dd> <p>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. </p> <dt><a name="DB_REP_JOIN_FAILURE">DB_REP_JOIN_FAILURE</a><dd> <p>The DB_ENV->rep_process_message method will return DB_REP_JOIN_FAILURE if a new master has been chosen but the client is unable to synchronize with the new master (possibly because the client has been configured with the <a href="../../db46-devel-4.6.21/api_c/rep_config.html#DB_REP_CONF_NOAUTOINIT">DB_REP_CONF_NOAUTOINIT</a> flag to turn-off automatic internal initialization). </p> <dt><a name="DB_REP_NEWSITE">DB_REP_NEWSITE</a><dd> <p>The DB_ENV->rep_process_message method will return DB_REP_NEWSITE if the system received contact information from a new environment. The <b>rec</b> parameter contains the opaque data specified in the <b>cdata</b> parameter to the <a href="../../db46-devel-4.6.21/api_c/rep_start.html">DB_ENV->rep_start</a>. The application should take whatever action is needed to establish a communication channel with this new environment. </p> <dt><a name="DB_REP_NOTPERM">DB_REP_NOTPERM</a><dd> <p>The DB_ENV->rep_process_message method will return DB_REP_NOTPERM if a message carrying a <a href="../../db46-devel-4.6.21/api_c/rep_transport.html#DB_REP_PERMANENT">DB_REP_PERMANENT</a> 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. </p> </dl> <p>Unless otherwise specified, the DB_ENV->rep_process_message method returns a non-zero error value on failure and 0 on success. </p> <h3>Parameters</h3> <dl compact> <dt><b>control</b><dd>The <b>control</b> parameter should reference a copy of the <b>control</b> parameter specified by Berkeley DB on the sending environment. <dt><b>envid</b><dd>The <b>envid</b> parameter should contain the local identifier that corresponds to the environment that sent the message to be processed (see <a href="../../db46-devel-4.6.21/ref/rep/id.html">Replication environment IDs</a> for more information). <dt><b>rec</b><dd>The <b>rec</b> parameter should reference a copy of the <b>rec</b> parameter specified by Berkeley DB on the sending environment. <dt><b>ret_lsnp</b><dd>If DB_ENV->rep_process_message method returns DB_REP_NOTPERM then the <b>ret_lsnp</b> 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 <b>ret_lsnp</b> 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 <b>ret_lsnp</b> is undefined. </dl> <hr size=1 noshade> <h3>Class</h3> <a href="../../db46-devel-4.6.21/api_c/env_class.html">DB_ENV</a> <h3>See Also</h3> <a href="../../db46-devel-4.6.21/api_c/rep_list.html">Replication and Related Methods</a> </tt> <table width="100%"><tr><td><br></td><td align=right> <a href="../../db46-devel-4.6.21/api_c/api_core.html"><img src="../../db46-devel-4.6.21/images/api.gif" alt="API"></a><a href="../../db46-devel-4.6.21/ref/toc.html"><img src="../../db46-devel-4.6.21/images/ref.gif" alt="Ref"></a> </td></tr></table> <p><font size=1>Copyright (c) 1996,2007 Oracle. All rights reserved.</font> </body> </html>