Debian Codegraph @

docs/programmer_reference/rep_mgrmulti.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>Running Replication Manager in multiple processes</title>
7 <link rel="stylesheet" href="gettingStarted.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 Programmer's Reference Guide" />
10 <link rel="up" href="rep.html" title="Chapter 12.  Berkeley DB Replication" />
11 <link rel="prev" href="rep_filename.html" title="Managing Replication Files" />
12 <link rel="next" href="rep_replicate.html" title="Running Replication using the db_replicate Utility" />
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">Running Replication Manager in multiple processes</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="rep_filename.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 12. 
26 Berkeley DB Replication
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="rep_replicate.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="rep_mgrmulti"></a>Running Replication Manager in multiple processes</h2>
38 </div>
39 </div>
40 </div>
41 <div class="toc">
42 <dl>
43 <dt>
44 <span class="sect2">
45 <a href="rep_mgrmulti.html#idp52420616">One replication process and multiple subordinate processes</a>
46 </span>
47 </dt>
48 <dt>
49 <span class="sect2">
50 <a href="rep_mgrmulti.html#idp52417008">Persistence of local site network address configuration</a>
51 </span>
52 </dt>
53 <dt>
54 <span class="sect2">
55 <a href="rep_mgrmulti.html#idp52400144">Programming considerations</a>
56 </span>
57 </dt>
58 <dt>
59 <span class="sect2">
60 <a href="rep_mgrmulti.html#idp52414488">Handling failure</a>
61 </span>
62 </dt>
63 <dt>
64 <span class="sect2">
65 <a href="rep_mgrmulti.html#idp52412256">Other miscellaneous rules</a>
66 </span>
67 </dt>
68 </dl>
69 </div>
70 <p>Replication Manager supports shared access to a database environment
71 from multiple processes.</p>
72 <div class="sect2" lang="en" xml:lang="en">
73 <div class="titlepage">
74 <div>
75 <div>
76 <h3 class="title"><a id="idp52420616"></a>One replication process and multiple subordinate processes</h3>
77 </div>
78 </div>
79 </div>
80 <p>Each site in a replication group has just one network address (TCP/IP
81 host name and port number). This means that only one process can
82 accept incoming connections. At least one application process must
83 invoke the <a href="../api_reference/C/repmgrstart.html" class="olink">DB_ENV-&gt;repmgr_start()</a> method to initiate communications
84 and management of the replication state.</p>
85 <p>If it is convenient, multiple processes may issue calls to the
86 Replication Manager configuration methods, and multiple processes may
87 call <a href="../api_reference/C/repmgrstart.html" class="olink">DB_ENV-&gt;repmgr_start()</a>. Replication Manager automatically opens
88 the TCP/IP listening socket in the first process to do so (we'll call
89 it the "replication process" here), and ignores this step in any
90 subsequent processes ("subordinate processes").</p>
91 </div>
92 <div class="sect2" lang="en" xml:lang="en">
93 <div class="titlepage">
94 <div>
95 <div>
96 <h3 class="title"><a id="idp52417008"></a>Persistence of local site network address configuration</h3>
97 </div>
98 </div>
99 </div>
100 <p>The local site network address is stored in shared memory,
101 and remains intact even when (all) processes close their environment
102 handles gracefully and terminate. A process which opens an
103 environment handle without running recovery automatically inherits the
104 existing local site network address configuration. Such a process may not
105 change the local site address (although it is allowed to redundantly
106 specify a local site configuration matching that which is already in
107 effect).</p>
108 <p>In order to change the local site network address, the application
109 must run recovery. The application can then specify a new local site
110 address before restarting Replication Manager. The application should also
111 remove the old local site address from the replication group if it is no
112 longer needed.</p>
113 </div>
114 <div class="sect2" lang="en" xml:lang="en">
115 <div class="titlepage">
116 <div>
117 <div>
118 <h3 class="title"><a id="idp52400144"></a>Programming considerations</h3>
119 </div>
120 </div>
121 </div>
122 <p>Note that Replication Manager applications must follow all the usual
123 rules for Berkeley DB multi-threaded and/or multi-process
124 applications, such as ensuring that the recovery operation occurs
125 single-threaded, only once, before any other thread or processes
126 operate in the environment.
127 Since Replication Manager creates its own background threads which
128 operate on the environment,
129 all environment handles must be opened with the <a href="../api_reference/C/dbopen.html#open_DB_THREAD" class="olink">DB_THREAD</a> flag, even
130 if the application is otherwise single-threaded per process.</p>
131 <p>At the replication master site, each Replication Manager process opens
132 outgoing TCP/IP connections to all clients in the replication group.
133 It uses these direct connections to send to clients any log records
134 resulting from update transactions that the process executes. But all
135 other replication activity —message processing, elections,
136 etc.— takes place only in the "replication process".</p>
137 <p>Replication Manager notifies the application of certain events, using
138 the callback function configured with the <a href="../api_reference/C/envevent_notify.html" class="olink">DB_ENV-&gt;set_event_notify()</a>
139 method. These notifications occur only in the process where the event
140 itself occurred. Generally this means that most notifications occur
141 only in the "replication process". Currently the only replication
142 notification that can occur in a "subordinate process" is
143 <a href="../api_reference/C/envevent_notify.html#event_notify_DB_EVENT_REP_PERM_FAILED" class="olink">DB_EVENT_REP_PERM_FAILED</a>.</p>
144 <p>It is not supported for a process running Replication Manager to
145 spawn a subprocess.</p>
146 </div>
147 <div class="sect2" lang="en" xml:lang="en">
148 <div class="titlepage">
149 <div>
150 <div>
151 <h3 class="title"><a id="idp52414488"></a>Handling failure</h3>
152 </div>
153 </div>
154 </div>
155 <p>Multi-process Replication Manager applications should handle failures
156 in a manner consistent with the rules described in
157 <a class="xref" href="transapp_fail.html" title="Handling failure in Transactional Data Store applications">Handling failure in Transactional Data Store applications</a>.
158 To summarize, there are
159 two ways to handle failure of a process:</p>
160 <div class="orderedlist">
161 <ol type="1">
162 <li>
163 <p>
164 The simple way is to kill all remaining processes, run
165 recovery, and then restart all processes from the beginning.
166 But this can be a bit drastic.
167 </p>
168 </li>
169 <li>
170 <p>
171 Using the <a href="../api_reference/C/envfailchk.html" class="olink">DB_ENV-&gt;failchk()</a> method, it is sometimes possible to
172 leave surviving processes running, and just restart the failed
173 process.
174 </p>
175 <p>
176 Multi-process Replication Manager applications using this
177 technique must start a new process when an old process fails.
178 It is not possible for a "subordinate process" to take over the
179 duties of a failed "replication process". If the failed
180 process happens to be the replication process, then after a
181 failchk() call the next process to call <a href="../api_reference/C/repmgrstart.html" class="olink">DB_ENV-&gt;repmgr_start()</a> will
182 become the new replication process.
183 </p>
184 </li>
185 </ol>
186 </div>
187 </div>
188 <div class="sect2" lang="en" xml:lang="en">
189 <div class="titlepage">
190 <div>
191 <div>
192 <h3 class="title"><a id="idp52412256"></a>Other miscellaneous rules</h3>
193 </div>
194 </div>
195 </div>
196 <div class="orderedlist">
197 <ol type="1">
198 <li>A database environment may not be shared between a Replication
199 Manager application process and a Base API application process.</li>
200 <li>It is not possible to run multiple Replication Manager processes
201 during mixed-version live upgrades from Berkeley DB versions prior
202 to 4.8.</li>
203 </ol>
204 </div>
205 </div>
206 </div>
207 <div class="navfooter">
208 <hr />
209 <table width="100%" summary="Navigation footer">
210 <tr>
211 <td width="40%" align="left"><a accesskey="p" href="rep_filename.html">Prev</a> </td>
212 <td width="20%" align="center">
213 <a accesskey="u" href="rep.html">Up</a>
214 </td>
215 <td width="40%" align="right"> <a accesskey="n" href="rep_replicate.html">Next</a></td>
216 </tr>
217 <tr>
218 <td width="40%" align="left" valign="top">Managing Replication Files </td>
219 <td width="20%" align="center">
220 <a accesskey="h" href="index.html">Home</a>
221 </td>
222 <td width="40%" align="right" valign="top"> Running Replication using the db_replicate Utility</td>
223 </tr>
224 </table>
225 </div>
226 </body>
227 </html>