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::repmgr_set_ack_policy()</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="repmgrget_ack_policy.html" title="DbEnv::repmgr_get_ack_policy()" /> 12 <link rel="next" href="repmgrlocal_site.html" title="DbEnv::repmgr_set_local_site()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DbEnv::repmgr_set_ack_policy()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="repmgrget_ack_policy.html">Prev</a> </td> 22 <th width="60%" align="center">Chapter 11. 23 Replication Methods 24 </th> 25 <td width="20%" align="right"> <a accesskey="n" href="repmgrlocal_site.html">Next</a></td> 26 </tr> 27 </table> 28 <hr /> 29 </div> 30 <div class="sect1" lang="en" xml:lang="en"> 31 <div class="titlepage"> 32 <div> 33 <div> 34 <h2 class="title" style="clear: both"><a id="repmgrset_ack_policy"></a>DbEnv::repmgr_set_ack_policy()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41DbEnv::repmgr_set_ack_policy(int ack_policy); </pre> 42 <p> 43 The <code class="methodname">DbEnv::repmgr_set_ack_policy()</code> method specifies how master and 44 client sites will handle acknowledgment of replication messages which are necessary for 45 "permanent" records. The current implementation requires all sites in a replication group 46 configure the same acknowledgement policy. 47 </p> 48 <p> 49 The database environment's replication subsystem may also be configured using the 50 environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. The 51 syntax of the entry in that file is a single line with the string "repmgr_set_ack_policy", 52 one or more whitespace characters, and the <span class="bold"><strong>ack_policy</strong></span> 53 parameter specified as a string. For example, "repmgr_set_ack_policy DB_REPMGR_ACKS_ALL". 54 Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is read 55 when the database environment is opened, it will silently overrule configuration done 56 before that time. 57 </p> 58 <p> 59 Waiting for client acknowledgements is always limited by the 60 <a class="link" href="repset_timeout.html#set_timeout_DB_REP_ACK_TIMEOUT">DB_REP_ACK_TIMEOUT</a> 61 specified by the <a class="xref" href="repset_timeout.html" title="DbEnv::rep_set_timeout()">DbEnv::rep_set_timeout()</a> method. 62 </p> 63 <p> 64 The <code class="methodname">DbEnv::repmgr_set_ack_policy()</code> method configures a database 65 environment, not only operations performed using the specified 66 <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> handle. 67 </p> 68 <p> 69 The <code class="methodname">DbEnv::repmgr_set_ack_policy()</code> method may be called at any time 70 during the life of the application. 71 </p> 72 <p> 73 The <code class="methodname">DbEnv::repmgr_set_ack_policy()</code> <span> 74 75 <span> 76 method either returns a non-zero error value or throws an 77 exception that encapsulates a non-zero error value on 78 failure, and returns 0 on success. 79 </span> 80 </span> 81 </p> 82 <div class="sect2" lang="en" xml:lang="en"> 83 <div class="titlepage"> 84 <div> 85 <div> 86 <h3 class="title"><a id="id1707338"></a>Parameters</h3> 87 </div> 88 </div> 89 </div> 90 <div class="sect3" lang="en" xml:lang="en"> 91 <div class="titlepage"> 92 <div> 93 <div> 94 <h4 class="title"><a id="id1707457"></a>ack_policy</h4> 95 </div> 96 </div> 97 </div> 98 <p> 99 Some acknowledgement policies use the concept of an 100 electable peer, which is a client capable of being 101 subsequently elected master of the replication 102 group. The <span class="bold"><strong>ack_policy</strong></span> parameter 103 must be set to one of the following values: 104 </p> 105 <div class="itemizedlist"> 106 <ul type="disc"> 107 <li> 108 <p><a id="ackspolicy_DB_REPMGR_ACKS_ALL"></a> 109 <span class="bold"><strong>DB_REPMGR_ACKS_ALL</strong></span> 110 </p> 111 <p> 112 The master should wait until all replication clients have acknowledged 113 each permanent replication message. 114 </p> 115 </li> 116 <li> 117 <p><a id="ackspolicy_DB_REPMGR_ACKS_ALL_PEERS"></a> 118 <span class="bold"><strong>DB_REPMGR_ACKS_ALL_PEERS</strong></span> 119 </p> 120 <p> 121 The master should wait until all electable peers have acknowledged 122 each permanent replication message. 123 </p> 124 </li> 125 <li> 126 <p><a id="ackspolicy_DB_REPMGR_ACKS_NONE"></a> 127 <span class="bold"><strong>DB_REPMGR_ACKS_NONE</strong></span> 128 </p> 129 <p> 130 The master should not wait for any client replication message 131 acknowledgments. 132 </p> 133 </li> 134 <li> 135 <p><a id="ackspolicy_DB_REPMGR_ACKS_ONE"></a> 136 <span class="bold"><strong>DB_REPMGR_ACKS_ONE</strong></span> 137 </p> 138 <p> 139 The master should wait until at least one client site has acknowledged 140 each permanent replication message. 141 </p> 142 </li> 143 <li> 144 <p><a id="ackspolicy_DB_REPMGR_ACKS_ONE_PEER"></a> 145 <span class="bold"><strong>DB_REPMGR_ACKS_ONE_PEER</strong></span> 146 </p> 147 <p> 148 The master should wait until at least one electable peer has 149 acknowledged each permanent replication message. 150 </p> 151 </li> 152 <li> 153 <p><a id="ackspolicy_DB_REPMGR_ACKS_QUORUM"></a> 154 <span class="bold"><strong>DB_REPMGR_ACKS_QUORUM</strong></span> 155 </p> 156 <p> 157 The master should wait until it has received acknowledgements from the 158 minimum number of electable peers sufficient to ensure that the effect 159 of the permanent record remains durable if an election is held. This is the default acknowledgement 160 policy. 161 </p> 162 </li> 163 </ul> 164 </div> 165 </div> 166 </div> 167 <div class="sect2" lang="en" xml:lang="en"> 168 <div class="titlepage"> 169 <div> 170 <div> 171 <h3 class="title"><a id="id1707593"></a>Errors</h3> 172 </div> 173 </div> 174 </div> 175 <p> 176 The <code class="methodname">DbEnv::repmgr_set_ack_policy()</code> 177 <span> 178 179 <span> 180 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 181 exception, encapsulating one of the following non-zero errors, or return one 182 of the following non-zero errors: 183 </span> 184 </span> 185 </p> 186 <div class="sect3" lang="en" xml:lang="en"> 187 <div class="titlepage"> 188 <div> 189 <div> 190 <h4 class="title"><a id="id1707476"></a>EINVAL</h4> 191 </div> 192 </div> 193 </div> 194 <p> 195 If this method is called from a base replication API 196 application; or if an invalid flag value or parameter was 197 specified. 198 </p> 199 </div> 200 </div> 201 <div class="sect2" lang="en" xml:lang="en"> 202 <div class="titlepage"> 203 <div> 204 <div> 205 <h3 class="title"><a id="id1707629"></a>Class</h3> 206 </div> 207 </div> 208 </div> 209 <p> 210 <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> 211 </p> 212 </div> 213 <div class="sect2" lang="en" xml:lang="en"> 214 <div class="titlepage"> 215 <div> 216 <div> 217 <h3 class="title"><a id="id1707610"></a>See Also</h3> 218 </div> 219 </div> 220 </div> 221 <p> 222 <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a> 223 </p> 224 </div> 225 </div> 226 <div class="navfooter"> 227 <hr /> 228 <table width="100%" summary="Navigation footer"> 229 <tr> 230 <td width="40%" align="left"><a accesskey="p" href="repmgrget_ack_policy.html">Prev</a> </td> 231 <td width="20%" align="center"> 232 <a accesskey="u" href="rep.html">Up</a> 233 </td> 234 <td width="40%" align="right"> <a accesskey="n" href="repmgrlocal_site.html">Next</a></td> 235 </tr> 236 <tr> 237 <td width="40%" align="left" valign="top">DbEnv::repmgr_get_ack_policy() </td> 238 <td width="20%" align="center"> 239 <a accesskey="h" href="index.html">Home</a> 240 </td> 241 <td width="40%" align="right" valign="top"> DbEnv::repmgr_set_local_site()</td> 242 </tr> 243 </table> 244 </div> 245 </body> 246</html> 247