1<!--$Id: rep_message.so,v 1.39 2007/03/20 20:20:26 alanb Exp $--> 2<!--Copyright (c) 1997,2008 Oracle. All rights reserved.--> 3<!--See the file LICENSE for redistribution information.--> 4<html> 5<head> 6<title>Berkeley DB: DbEnv::rep_process_message</title> 7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> 8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> 9</head> 10<body bgcolor=white> 11<table width="100%"><tr valign=top> 12<td> 13<b>DbEnv::rep_process_message</b> 14</td> 15<td align=right> 16<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a> 17<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td> 18</tr></table> 19<hr size=1 noshade> 20<tt> 21<b><pre> 22#include <db_cxx.h> 23<p> 24int 25DbEnv::rep_process_message(Dbt *control, Dbt *rec, int envid, DbLsn *ret_lsnp) 26</pre></b> 27<hr size=1 noshade> 28<b>Description: DbEnv::rep_process_message</b> 29<p>The DbEnv::rep_process_message method processes an incoming replication message sent 30by a member of the replication group to the local database environment.</p> 31<p>The DbEnv::rep_process_message method is not called by most replication 32applications. It should only be called by applications implementing 33their own network transport layer, explicitly holding replication group 34elections and handling replication messages outside of the replication 35manager framework.</p> 36<p>For implementation reasons, all incoming replication messages must be 37processed using the same <a href="../api_cxx/env_class.html">DbEnv</a> handle. It is not required that 38a single thread of control process all messages, only that all threads 39of control processing messages use the same handle.</p> 40<p>The DbEnv::rep_process_message method has additional return values:</p> 41<br> 42<b><a name="DB_REP_DUPMASTER">DB_REP_DUPMASTER</a></b><ul compact><li> 43<p>The DbEnv::rep_process_message method 44will either return DB_REP_DUPMASTER or 45throw an exception that encapsulates DB_REP_DUPMASTER if the replication group has more than one master. 46The application should reconfigure itself as a client by calling the 47<a href="../api_cxx/rep_start.html">DbEnv::rep_start</a> method, and then call for an election by calling 48<a href="../api_cxx/rep_elect.html">DbEnv::rep_elect</a>. 49</p></ul> 50<b><a name="DB_REP_HOLDELECTION">DB_REP_HOLDELECTION</a></b><ul compact><li> 51<p>The DbEnv::rep_process_message method 52will either return DB_REP_HOLDELECTION or 53throw an exception that encapsulates DB_REP_HOLDELECTION if an election is needed. 54The application should call for an election by calling <a href="../api_cxx/rep_elect.html">DbEnv::rep_elect</a>. 55</p></ul> 56<b><a name="DB_REP_IGNORE">DB_REP_IGNORE</a></b><ul compact><li> 57<p>The DbEnv::rep_process_message method will return DB_REP_IGNORE if this message cannot be processed. 58This is an indication that this message is irrelevant to the current 59replication state (for example, an old message 60from a previous generation arrives and is processed late). 61</p></ul> 62<b><a name="DB_REP_ISPERM">DB_REP_ISPERM</a></b><ul compact><li> 63<p>The DbEnv::rep_process_message method will return DB_REP_ISPERM if processing this message results in the processing of records 64that are permanent. 65The maximum LSN of the permanent records stored is returned. 66</p></ul> 67<b><a name="DB_REP_JOIN_FAILURE">DB_REP_JOIN_FAILURE</a></b><ul compact><li> 68<p>The DbEnv::rep_process_message method will return DB_REP_JOIN_FAILURE if a new master has been chosen but the client is unable to synchronize 69with the new master (possibly because the client has been configured 70with the <a href="../api_cxx/rep_config.html#DB_REP_CONF_NOAUTOINIT">DB_REP_CONF_NOAUTOINIT</a> flag to turn-off automatic 71internal initialization). 72</p></ul> 73<b><a name="DB_REP_NEWSITE">DB_REP_NEWSITE</a></b><ul compact><li> 74<p>The DbEnv::rep_process_message method will return DB_REP_NEWSITE if the system received contact information from a new environment. 75The <b>rec</b> parameter contains the opaque data specified in the 76<b>cdata</b> parameter to the <a href="../api_cxx/rep_start.html">DbEnv::rep_start</a>. The application 77should take whatever action is needed to establish a communication 78channel with this new environment. 79</p></ul> 80<b><a name="DB_REP_NOTPERM">DB_REP_NOTPERM</a></b><ul compact><li> 81<p>The DbEnv::rep_process_message method will return DB_REP_NOTPERM if a message carrying a <a href="../api_cxx/rep_transport.html#DB_REP_PERMANENT">DB_REP_PERMANENT</a> flag was processed 82successfully, but was not written to disk. 83The LSN of this record is returned. The application should take 84whatever action is deemed necessary to retain its recoverability 85characteristics. 86</p></ul> 87<br> 88<p>Unless otherwise specified, the DbEnv::rep_process_message method 89either returns a non-zero error value 90or throws an exception that encapsulates a non-zero error value on 91failure, and returns 0 on success. 92</p> 93<b>Parameters</b> <br> 94 <b>control</b><ul compact><li>The <b>control</b> parameter should reference a copy of the 95<b>control</b> parameter specified by Berkeley DB on the sending 96environment.</ul> 97 <b>envid</b><ul compact><li>The <b>envid</b> parameter should contain the local identifier that 98corresponds to the environment that sent the message to be processed 99(see <a href="../ref/rep/id.html">Replication environment IDs</a> for more 100information).</ul> 101 <b>rec</b><ul compact><li>The <b>rec</b> parameter should reference a copy of the <b>rec</b> 102parameter specified by Berkeley DB on the sending environment.</ul> 103 <b>ret_lsnp</b><ul compact><li>If DbEnv::rep_process_message method returns DB_REP_NOTPERM then the <b>ret_lsnp</b> 104parameter will contain the log sequence number of this permanent log 105message that could not be written to disk. If DbEnv::rep_process_message method 106returns DB_REP_ISPERM then the <b>ret_lsnp</b> parameter will contain 107largest log sequence number of the permanent records that are now 108written to disk as a result of processing this message. In all other 109cases the value of <b>ret_lsnp</b> is undefined.</ul> 110<br> 111<hr size=1 noshade> 112<br><b>Class</b> 113<a href="../api_cxx/env_class.html">DbEnv</a> 114<br><b>See Also</b> 115<a href="../api_cxx/rep_list.html">Replication and Related Methods</a> 116</tt> 117<table width="100%"><tr><td><br></td><td align=right> 118<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a> 119</td></tr></table> 120<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 121</body> 122</html> 123