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: DB_ENV-&gt;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>DB_ENV-&gt;rep_process_message</b>
14</td>
15<td align=right>
16<a href="../api_c/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 &lt;db.h&gt;
23<p>
24int
25DB_ENV-&gt;rep_process_message(DB_ENV *env,
26    DBT *control, DBT *rec, int envid, DB_LSN *ret_lsnp)
27</pre></b>
28<hr size=1 noshade>
29<b>Description: DB_ENV-&gt;rep_process_message</b>
30<p>The DB_ENV-&gt;rep_process_message method processes an incoming replication message sent
31by a member of the replication group to the local database environment.</p>
32<p>The DB_ENV-&gt;rep_process_message method is not called by most replication
33applications.  It should only be called by applications implementing
34their own network transport layer, explicitly holding replication group
35elections and handling replication messages outside of the replication
36manager framework.</p>
37<p>For implementation reasons, all incoming replication messages must be
38processed using the same <a href="../api_c/env_class.html">DB_ENV</a> handle.  It is not required that
39a single thread of control process all messages, only that all threads
40of control processing messages use the same handle.</p>
41<p>The DB_ENV-&gt;rep_process_message method has additional return values:</p>
42<br>
43<b><a name="DB_REP_DUPMASTER">DB_REP_DUPMASTER</a></b><ul compact><li>
44<p>The DB_ENV-&gt;rep_process_message method
45will return 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_c/rep_start.html">DB_ENV-&gt;rep_start</a> method, and then call for an election by calling
48<a href="../api_c/rep_elect.html">DB_ENV-&gt;rep_elect</a>.
49</p></ul>
50<b><a name="DB_REP_HOLDELECTION">DB_REP_HOLDELECTION</a></b><ul compact><li>
51<p>The DB_ENV-&gt;rep_process_message method
52will return DB_REP_HOLDELECTION if an election is needed.
53The application should call for an election by calling <a href="../api_c/rep_elect.html">DB_ENV-&gt;rep_elect</a>.
54</p></ul>
55<b><a name="DB_REP_IGNORE">DB_REP_IGNORE</a></b><ul compact><li>
56<p>The DB_ENV-&gt;rep_process_message method will return DB_REP_IGNORE if this message cannot be processed.
57This is an indication that this message is irrelevant to the current
58replication state (for example, an old message
59from a previous generation arrives and is processed late).
60</p></ul>
61<b><a name="DB_REP_ISPERM">DB_REP_ISPERM</a></b><ul compact><li>
62<p>The DB_ENV-&gt;rep_process_message method will return DB_REP_ISPERM if processing this message results in the processing of records
63that are permanent.
64The maximum LSN of the permanent records stored is returned.
65</p></ul>
66<b><a name="DB_REP_JOIN_FAILURE">DB_REP_JOIN_FAILURE</a></b><ul compact><li>
67<p>The DB_ENV-&gt;rep_process_message method will return DB_REP_JOIN_FAILURE if a new master has been chosen but the client is unable to synchronize
68with the new master (possibly because the client has been configured
69with the <a href="../api_c/rep_config.html#DB_REP_CONF_NOAUTOINIT">DB_REP_CONF_NOAUTOINIT</a> flag to turn-off automatic
70internal initialization).
71</p></ul>
72<b><a name="DB_REP_NEWSITE">DB_REP_NEWSITE</a></b><ul compact><li>
73<p>The DB_ENV-&gt;rep_process_message method will return DB_REP_NEWSITE if the system received contact information from a new environment.
74The <b>rec</b> parameter contains the opaque data specified in the
75<b>cdata</b> parameter to the <a href="../api_c/rep_start.html">DB_ENV-&gt;rep_start</a>.  The application
76should take whatever action is needed to establish a communication
77channel with this new environment.
78</p></ul>
79<b><a name="DB_REP_NOTPERM">DB_REP_NOTPERM</a></b><ul compact><li>
80<p>The DB_ENV-&gt;rep_process_message method will return DB_REP_NOTPERM if a message carrying a <a href="../api_c/rep_transport.html#DB_REP_PERMANENT">DB_REP_PERMANENT</a> flag was processed
81successfully, but was not written to disk.
82The LSN of this record is returned.  The application should take
83whatever action is deemed necessary to retain its recoverability
84characteristics.
85</p></ul>
86<br>
87<p>Unless otherwise specified, the DB_ENV-&gt;rep_process_message method
88returns a non-zero error value on failure
89and 0 on success.
90</p>
91<b>Parameters</b> <br>
92 <b>control</b><ul compact><li>The <b>control</b> parameter should reference a copy of the
93<b>control</b> parameter specified by Berkeley DB on the sending
94environment.</ul>
95 <b>envid</b><ul compact><li>The <b>envid</b> parameter should contain the local identifier that
96corresponds to the environment that sent the message to be processed
97(see <a href="../ref/rep/id.html">Replication environment IDs</a> for more
98information).</ul>
99 <b>rec</b><ul compact><li>The <b>rec</b> parameter should reference a copy of the <b>rec</b>
100parameter specified by Berkeley DB on the sending environment.</ul>
101 <b>ret_lsnp</b><ul compact><li>If DB_ENV-&gt;rep_process_message method returns DB_REP_NOTPERM then the <b>ret_lsnp</b>
102parameter will contain the log sequence number of this permanent log
103message that could not be written to disk.  If DB_ENV-&gt;rep_process_message method
104returns DB_REP_ISPERM then the <b>ret_lsnp</b> parameter will contain
105largest log sequence number of the permanent records that are now
106written to disk as a result of processing this message.  In all other
107cases the value of <b>ret_lsnp</b> is undefined.</ul>
108<br>
109<hr size=1 noshade>
110<br><b>Class</b>
111<a href="../api_c/env_class.html">DB_ENV</a>
112<br><b>See Also</b>
113<a href="../api_c/rep_list.html">Replication and Related Methods</a>
114</tt>
115<table width="100%"><tr><td><br></td><td align=right>
116<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
117</td></tr></table>
118<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
119</body>
120</html>
121