Debian Codegraph @

docs/api_reference/CXX/repmessage.html

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <title>DbEnv::rep_process_message()</title>
7 <link rel="stylesheet" href="apiReference.css" type="text/css" />
8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9 <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" />
10 <link rel="up" href="rep.html" title="Chapter 11.  Replication Methods" />
11 <link rel="prev" href="repget_timeout.html" title="DbEnv::rep_get_timeout()" />
12 <link rel="next" href="repclockskew.html" title="DbEnv::rep_set_clockskew()" />
13 </head>
14 <body>
15 <div xmlns="" class="navheader">
16 <div class="libver">
17 <p>Library Version 11.2.5.3</p>
18 </div>
19 <table width="100%" summary="Navigation header">
20 <tr>
21 <th colspan="3" align="center">DbEnv::rep_process_message()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="repget_timeout.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 11. 
26 Replication Methods
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="repclockskew.html">Next</a></td>
29 </tr>
30 </table>
31 <hr />
32 </div>
33 <div class="sect1" lang="en" xml:lang="en">
34 <div class="titlepage">
35 <div>
36 <div>
37 <h2 class="title" style="clear: both"><a id="repmessage"></a>DbEnv::rep_process_message()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db_cxx.h&gt;
42
43 int
44 DbEnv::rep_process_message(Dbt *control, Dbt *rec, int envid,
45 DbLsn *ret_lsnp)</pre>
46 <p>
47 The <code class="methodname">DbEnv::rep_process_message()</code> method processes an incoming
48 replication message sent by a member of the replication group to the
49 local database environment.
50 </p>
51 <p>
52 The <code class="methodname">DbEnv::rep_process_message()</code> method is not called by most
53 replication applications. It should only be called by Base API applications
54 implementing their own network transport layer, explicitly holding
55 replication group elections and handling replication messages outside
56 of the Replication Manager framework.
57 </p>
58 <p>
59 For implementation reasons, all incoming replication messages must be
60 processed using the same <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a> handle. It is not
61 required that a single thread of control process all messages, only
62 that all threads of control processing messages use the same handle.
63 </p>
64 <p>
65 Before calling this method, the enclosing database environment must
66 already have been opened by calling the
67 <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> method and must
68 already have been configured to send replication messages by
69 calling the <a class="xref" href="reptransport.html" title="DbEnv::rep_set_transport()">DbEnv::rep_set_transport()</a>
70 method.
71 </p>
72 <p>
73 The <code class="methodname">DbEnv::rep_process_message()</code> method has additional return
74 values:
75 </p>
76 <div class="itemizedlist">
77 <ul type="disc">
78 <li>
79 <p><a id="repmsg_DB_REP_DUPMASTER"></a>
80 <span class="bold"><strong>DB_REP_DUPMASTER</strong></span>
81 </p>
82 <p>
83 The <code class="methodname">DbEnv::rep_process_message()</code> method will return
84 <code class="literal">DB_REP_DUPMASTER</code> if the replication group has more than one
85 master. The application should reconfigure itself as a client by calling the
86 <a class="xref" href="repstart.html" title="DbEnv::rep_start()">DbEnv::rep_start()</a> method, and then call for an
87 election by calling <a class="xref" href="repelect.html" title="DbEnv::rep_elect()">DbEnv::rep_elect()</a>.
88 </p>
89 </li>
90 <li>
91 <p><a id="repmsg_DB_REP_HOLDELECTION"></a>
92 <span class="bold"><strong>DB_REP_HOLDELECTION</strong></span>
93 </p>
94 <p>
95 The <code class="methodname">DbEnv::rep_process_message()</code> method will return
96 <code class="literal">DB_REP_HOLDELECTION</code> if an election is needed. The application
97 should call for an election by calling
98 <a class="xref" href="repelect.html" title="DbEnv::rep_elect()">DbEnv::rep_elect()</a>.
99 </p>
100 </li>
101 <li>
102 <p><a id="repmsg_DB_REP_IGNORE"></a>
103 <span class="bold"><strong>DB_REP_IGNORE</strong></span>
104 </p>
105 <p>
106 The <code class="methodname">DbEnv::rep_process_message()</code> method will return
107 <code class="literal">DB_REP_IGNORE</code> if this message cannot be processed. This is an
108 indication that this message is irrelevant to the current replication state (for
109 example, an old message from a previous generation arrives and is processed late).
110 </p>
111 </li>
112 <li>
113 <p><a id="repmsg_DB_REP_ISPERM"></a>
114 <span class="bold"><strong>DB_REP_ISPERM</strong></span>
115 </p>
116 <p>
117 The <code class="methodname">DbEnv::rep_process_message()</code> method will return
118 <code class="literal">DB_REP_ISPERM</code> if processing this message results in the
119 processing of records that are permanent. The maximum LSN of the permanent records
120 stored is returned.
121 </p>
122 </li>
123 <li>
124 <p><a id="repmsg_DB_REP_JOIN_FAILURE"></a>
125 <span class="bold"><strong>DB_REP_JOIN_FAILURE</strong></span>
126 </p>
127 <p>
128 The <code class="methodname">DbEnv::rep_process_message()</code> method will return
129 <code class="literal">DB_REP_JOIN_FAILURE</code> if a new master has been chosen but the
130 client is unable to synchronize with the new master. This is possibly because the client
131 has turned off automatic internal initialization by setting the
132 <a class="link" href="repconfig.html#config_DB_REP_CONF_AUTOINIT">DB_REP_CONF_AUTOINIT</a>
133 flag to <code class="literal">0</code>.
134 </p>
135 </li>
136 <li>
137 <p><a id="repmsg_DB_REP_NEWSITE"></a>
138 <span class="bold"><strong>DB_REP_NEWSITE</strong></span>
139 </p>
140 <p>
141 The <code class="methodname">DbEnv::rep_process_message()</code> method will return
142 <code class="literal">DB_REP_NEWSITE</code> if the system received contact information from a
143 new environment. The <span class="bold"><strong>rec</strong></span> parameter contains the
144 opaque data specified to the <a class="xref" href="repstart.html" title="DbEnv::rep_start()">DbEnv::rep_start()</a>
145 <span class="bold"><strong>cdata</strong></span> parameter. The application should
146 take whatever action is needed to establish a communication channel with this new
147 environment.
148 </p>
149 </li>
150 <li>
151 <p><a id="repmsg_DB_REP_NOTPERM"></a>
152 <span class="bold"><strong>DB_REP_NOTPERM</strong></span>
153 </p>
154 <p>
155 The <code class="methodname">DbEnv::rep_process_message()</code> method will return
156 <code class="literal">DB_REP_NOTPERM</code> if a message carrying a
157 <a class="link" href="reptransport.html#transport_DB_REP_PERMANENT">DB_REP_PERMANENT</a>
158 flag was processed successfully, but was not written to disk. The LSN of this
159 record is returned. The application should take whatever action is deemed
160 necessary to retain its recoverability characteristics.
161 </p>
162 </li>
163 </ul>
164 </div>
165 <p>
166 Unless otherwise specified, the <code class="methodname">DbEnv::rep_process_message()</code>
167 <span>
168
169 <span>
170 method either returns a non-zero error value or throws an
171 exception that encapsulates a non-zero error value on
172 failure, and returns 0 on success.
173 </span>
174 </span>
175 </p>
176 <div class="sect2" lang="en" xml:lang="en">
177 <div class="titlepage">
178 <div>
179 <div>
180 <h3 class="title"><a id="idp9527384"></a>Parameters</h3>
181 </div>
182 </div>
183 </div>
184 <div class="sect3" lang="en" xml:lang="en">
185 <div class="titlepage">
186 <div>
187 <div>
188 <h4 class="title"><a id="idp9526736"></a>control</h4>
189 </div>
190 </div>
191 </div>
192 <p>
193 The <span class="bold"><strong>control</strong></span> parameter should
194 reference a copy of the <span class="bold"><strong>control</strong></span>
195 parameter specified by Berkeley DB on the sending environment.
196 See the <a class="xref" href="reptransport.html" title="DbEnv::rep_set_transport()">DbEnv::rep_set_transport()</a> method for more information.
197 </p>
198 </div>
199 <div class="sect3" lang="en" xml:lang="en">
200 <div class="titlepage">
201 <div>
202 <div>
203 <h4 class="title"><a id="idp9541904"></a>rec</h4>
204 </div>
205 </div>
206 </div>
207 <p>
208 The <span class="bold"><strong>rec</strong></span> parameter should reference a
209 copy of the <span class="bold"><strong>rec</strong></span> parameter specified
210 by Berkeley DB on the sending environment.
211 See the <a class="xref" href="reptransport.html" title="DbEnv::rep_set_transport()">DbEnv::rep_set_transport()</a> method for more information.
212 </p>
213 </div>
214 <div class="sect3" lang="en" xml:lang="en">
215 <div class="titlepage">
216 <div>
217 <div>
218 <h4 class="title"><a id="idp9543352"></a>envid</h4>
219 </div>
220 </div>
221 </div>
222 <p>
223 The <span class="bold"><strong>envid</strong></span> parameter should contain
224 the local identifier that corresponds to the environment that sent the
225 message to be processed (see <a href="../../programmer_reference/rep_id.html" class="olink">Replication environment IDs</a> for more
226 information).
227 </p>
228 </div>
229 <div class="sect3" lang="en" xml:lang="en">
230 <div class="titlepage">
231 <div>
232 <div>
233 <h4 class="title"><a id="idp9546032"></a>ret_lsnp</h4>
234 </div>
235 </div>
236 </div>
237 <p>
238 If <code class="methodname">DbEnv::rep_process_message()</code> method returns
239 <code class="literal">DB_REP_NOTPERM</code> then the
240 <span class="bold"><strong>ret_lsnp</strong></span> parameter will contain the log sequence
241 number of this permanent log message that could not be written to disk. If
242 <code class="methodname">DbEnv::rep_process_message()</code> method returns
243 <code class="literal">DB_REP_ISPERM</code> then the
244 <span class="bold"><strong>ret_lsnp</strong></span> parameter will contain largest log
245 sequence number of the permanent records that are now written to disk as a
246 result of processing this message. In all other cases the value of
247 <span class="bold"><strong>ret_lsnp</strong></span> is undefined.
248
249 </p>
250 </div>
251 </div>
252 <div class="sect2" lang="en" xml:lang="en">
253 <div class="titlepage">
254 <div>
255 <div>
256 <h3 class="title"><a id="idp9511800"></a>Errors</h3>
257 </div>
258 </div>
259 </div>
260 <p>
261 The <code class="methodname">DbEnv::rep_process_message()</code>
262 <span>
263
264 <span>
265 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a>
266 exception, encapsulating one of the following non-zero errors, or return one
267 of the following non-zero errors:
268 </span>
269 </span>
270 </p>
271 <div class="sect3" lang="en" xml:lang="en">
272 <div class="titlepage">
273 <div>
274 <div>
275 <h4 class="title"><a id="idp9554464"></a>EINVAL</h4>
276 </div>
277 </div>
278 </div>
279 <p>
280 If the database environment was not already configured to
281 communicate with a replication group by a call to
282 <a class="xref" href="reptransport.html" title="DbEnv::rep_set_transport()">DbEnv::rep_set_transport()</a>;
283 if the database environment was not already opened;
284 if this method is called from a Replication Manager
285 application; or if an invalid flag value or parameter
286 was specified.
287 </p>
288 </div>
289 </div>
290 <div class="sect2" lang="en" xml:lang="en">
291 <div class="titlepage">
292 <div>
293 <div>
294 <h3 class="title"><a id="idp9533976"></a>Class</h3>
295 </div>
296 </div>
297 </div>
298 <p>
299 <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>
300 </p>
301 </div>
302 <div class="sect2" lang="en" xml:lang="en">
303 <div class="titlepage">
304 <div>
305 <div>
306 <h3 class="title"><a id="idp9529376"></a>See Also</h3>
307 </div>
308 </div>
309 </div>
310 <p>
311 <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a>
312 </p>
313 </div>
314 </div>
315 <div class="navfooter">
316 <hr />
317 <table width="100%" summary="Navigation footer">
318 <tr>
319 <td width="40%" align="left"><a accesskey="p" href="repget_timeout.html">Prev</a> </td>
320 <td width="20%" align="center">
321 <a accesskey="u" href="rep.html">Up</a>
322 </td>
323 <td width="40%" align="right"> <a accesskey="n" href="repclockskew.html">Next</a></td>
324 </tr>
325 <tr>
326 <td width="40%" align="left" valign="top">DbEnv::rep_get_timeout() </td>
327 <td width="20%" align="center">
328 <a accesskey="h" href="index.html">Home</a>
329 </td>
330 <td width="40%" align="right" valign="top"> DbEnv::rep_set_clockskew()</td>
331 </tr>
332 </table>
333 </div>
334 </body>
335 </html>