<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Replication</title> <link rel="stylesheet" href="gettingStarted.css" type="text/css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> <link rel="start" href="index.html" title="Berkeley DB Upgrade Guide" /> <link rel="up" href="upgrade_4_2_toc.html" title="Chapter 8. Upgrading Berkeley DB 4.1 applications to Berkeley DB 4.2" /> <link rel="prev" href="upgrade_4_2_lockng.html" title="DB_LOCK_NOTGRANTED" /> <link rel="next" href="upgrade_4_2_nosync.html" title="Client replication environments" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">Replication</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="upgrade_4_2_lockng.html">Prev</a> </td> <th width="60%" align="center">Chapter 8. Upgrading Berkeley DB 4.1 applications to Berkeley DB 4.2</th> <td width="20%" align="right"> <a accesskey="n" href="upgrade_4_2_nosync.html">Next</a></td> </tr> </table> <hr /> </div> <div class="sect1" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h2 class="title" style="clear: both"><a id="upgrade_4_2_repinit"></a>Replication</h2> </div> </div> </div> <div class="toc"> <dl> <dt> <span class="sect2"> <a href="upgrade_4_2_repinit.html#id3706548">Replication initialization</a> </span> </dt> <dt> <span class="sect2"> <a href="upgrade_4_2_repinit.html#id3705554">Database methods and replication clients</a> </span> </dt> <dt> <span class="sect2"> <a href="upgrade_4_2_repinit.html#id3706132">DB_ENV->rep_process_message()</a> </span> </dt> </dl> </div> <div class="sect2" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h3 class="title"><a id="id3706548"></a>Replication initialization</h3> </div> </div> </div> <p>In the Berkeley DB 4.2 release, replication environments must be specifically initialized by any process that will ever do anything other than open databases in read-only mode (that is, any process which might call any of the Berkeley DB replication interfaces or modify databases). This initialization is done when the replication database environment handle is opened, by specifying the <a href="../api_reference/C/envopen.html#envopen_DB_INIT_REP" class="olink">DB_INIT_REP</a> flag to the <a href="../api_reference/C/envopen.html" class="olink">DB_ENV->open()</a> method.</p> </div> <div class="sect2" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h3 class="title"><a id="id3705554"></a>Database methods and replication clients</h3> </div> </div> </div> <p>All of the <a href="../api_reference/C/db.html" class="olink">DB</a> object methods may now return <code class="literal">DB_REP_HANDLE_DEAD</code> when a replication client changes masters. When this happens the <a href="../api_reference/C/db.html" class="olink">DB</a> handle is no longer able to be used and the application must close the handle using the <a href="../api_reference/C/dbclose.html" class="olink">DB->close()</a> method and open a new handle. This new return value is returned when a client unrolls a transaction in order to synchronize with the new master. Otherwise, if the application was permitted to use the original handle, it's possible the handle might attempt to access nonexistent resources.</p> </div> <div class="sect2" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h3 class="title"> <a id="id3706132"></a> <a href="../api_reference/C/repmessage.html" class="olink">DB_ENV->rep_process_message()</a> </h3> </div> </div> </div> <p>The <a href="../api_reference/C/repmessage.html" class="olink">DB_ENV->rep_process_message()</a> method has new return values and an log sequence number (LSN) associated with those return values. The new argument is <span class="bold"><strong>ret_lsnp</strong></span>, which is the returned LSN when the <a href="../api_reference/C/repmessage.html" class="olink">DB_ENV->rep_process_message()</a> method returns <a href="../api_reference/C/repmessage.html#repmsg_DB_REP_ISPERM" class="olink">DB_REP_ISPERM</a> or <a href="../api_reference/C/repmessage.html#repmsg_DB_REP_NOTPERM" class="olink">DB_REP_NOTPERM</a>. See <a href="../programmer_reference/rep_trans.html" class="olink">Transactional guarantees</a> for more information.</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="upgrade_4_2_lockng.html">Prev</a> </td> <td width="20%" align="center"> <a accesskey="u" href="upgrade_4_2_toc.html">Up</a> </td> <td width="40%" align="right"> <a accesskey="n" href="upgrade_4_2_nosync.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">DB_LOCK_NOTGRANTED </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> Client replication environments</td> </tr> </table> </div> </body> </html>