summaryrefslogtreecommitdiff
path: root/db/docs/api_c/rep_message.html
blob: 66f7c15dcbb75fa8815ea79fc8dc52a6c324ce35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!--$Id: rep_message.so,v 1.38 2006/06/24 00:33:22 alanb Exp $-->
<!--Copyright 1997-2006 by Oracle Corporation-->
<!--All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB: DB_ENV-&gt;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-&gt;rep_process_message</h3>
</td>
<td align=right>
<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></td>
</tr></table>
<hr size=1 noshade>
<tt>
<h3><pre>
#include &lt;db.h&gt;
<p>
int
DB_ENV-&gt;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-&gt;rep_process_message</h3>
<p>The DB_ENV-&gt;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-&gt;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="../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-&gt;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-&gt;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="../api_c/rep_start.html">DB_ENV-&gt;rep_start</a> method, and then call for an election by calling
<a href="../api_c/rep_elect.html">DB_ENV-&gt;rep_elect</a>.
</p>
<dt><a name="DB_REP_HOLDELECTION">DB_REP_HOLDELECTION</a><dd>
<p>The DB_ENV-&gt;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="../api_c/rep_elect.html">DB_ENV-&gt;rep_elect</a>.
</p>
<dt><a name="DB_REP_IGNORE">DB_REP_IGNORE</a><dd>
<p>The DB_ENV-&gt;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-&gt;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-&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
with the new master (possibly because the client has been configured
with the <a href="../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_NEWMASTER">DB_REP_NEWMASTER</a><dd>
<p>The DB_ENV-&gt;rep_process_message method will return DB_REP_NEWMASTER if a new master has been chosen.
The <b>envid</b> 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.
</p>
<dt><a name="DB_REP_NEWSITE">DB_REP_NEWSITE</a><dd>
<p>The DB_ENV-&gt;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="../api_c/rep_start.html">DB_ENV-&gt;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-&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
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-&gt;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="../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-&gt;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-&gt;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="../api_c/env_class.html">DB_ENV</a>
<h3>See Also</h3>
<a href="../api_c/rep_list.html">Replication and Related Methods</a>
</tt>
<table width="100%"><tr><td><br></td><td align=right>
<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>
</td></tr></table>
<p><font size=1>Copyright (c) 1996-2006 Oracle Corporation - All rights reserved.</font>
</body>
</html>