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>DB_ENV->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��10.�� Replication Methods" /> 11 <link rel="prev" href="repmgrget_ack_policy.html" title="DB_ENV->repmgr_get_ack_policy()" /> 12 <link rel="next" href="repmgrlocal_site.html" title="DB_ENV->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">DB_ENV->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��10.�� 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>DB_ENV->repmgr_set_ack_policy()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db.h> 39 40int 41DB_ENV->repmgr_set_ack_policy(DB_ENV *env, int ack_policy); </pre> 42 <p> 43 The <code class="methodname">DB_ENV->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="DB_ENV->rep_set_timeout()">DB_ENV->rep_set_timeout()</a> method. 62 </p> 63 <p> 64 The <code class="methodname">DB_ENV->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 DB_ENV Handle">DB_ENV</a> handle. 67 </p> 68 <p> 69 The <code class="methodname">DB_ENV->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">DB_ENV->repmgr_set_ack_policy()</code> <span> 74 <span> 75 method returns a non-zero error value on failure and 0 on success. 76 </span> 77 78 </span> 79 </p> 80 <div class="sect2" lang="en" xml:lang="en"> 81 <div class="titlepage"> 82 <div> 83 <div> 84 <h3 class="title"><a id="id1702827"></a>Parameters</h3> 85 </div> 86 </div> 87 </div> 88 <div class="sect3" lang="en" xml:lang="en"> 89 <div class="titlepage"> 90 <div> 91 <div> 92 <h4 class="title"><a id="id1702843"></a>ack_policy</h4> 93 </div> 94 </div> 95 </div> 96 <p> 97 Some acknowledgement policies use the concept of an 98 electable peer, which is a client capable of being 99 subsequently elected master of the replication 100 group. The <span class="bold"><strong>ack_policy</strong></span> parameter 101 must be set to one of the following values: 102 </p> 103 <div class="itemizedlist"> 104 <ul type="disc"> 105 <li> 106 <p><a id="ackspolicy_DB_REPMGR_ACKS_ALL"></a> 107 <span class="bold"><strong>DB_REPMGR_ACKS_ALL</strong></span> 108 </p> 109 <p> 110 The master should wait until all replication clients have acknowledged 111 each permanent replication message. 112 </p> 113 </li> 114 <li> 115 <p><a id="ackspolicy_DB_REPMGR_ACKS_ALL_PEERS"></a> 116 <span class="bold"><strong>DB_REPMGR_ACKS_ALL_PEERS</strong></span> 117 </p> 118 <p> 119 The master should wait until all electable peers have acknowledged 120 each permanent replication message. 121 </p> 122 </li> 123 <li> 124 <p><a id="ackspolicy_DB_REPMGR_ACKS_NONE"></a> 125 <span class="bold"><strong>DB_REPMGR_ACKS_NONE</strong></span> 126 </p> 127 <p> 128 The master should not wait for any client replication message 129 acknowledgments. 130 </p> 131 </li> 132 <li> 133 <p><a id="ackspolicy_DB_REPMGR_ACKS_ONE"></a> 134 <span class="bold"><strong>DB_REPMGR_ACKS_ONE</strong></span> 135 </p> 136 <p> 137 The master should wait until at least one client site has acknowledged 138 each permanent replication message. 139 </p> 140 </li> 141 <li> 142 <p><a id="ackspolicy_DB_REPMGR_ACKS_ONE_PEER"></a> 143 <span class="bold"><strong>DB_REPMGR_ACKS_ONE_PEER</strong></span> 144 </p> 145 <p> 146 The master should wait until at least one electable peer has 147 acknowledged each permanent replication message. 148 </p> 149 </li> 150 <li> 151 <p><a id="ackspolicy_DB_REPMGR_ACKS_QUORUM"></a> 152 <span class="bold"><strong>DB_REPMGR_ACKS_QUORUM</strong></span> 153 </p> 154 <p> 155 The master should wait until it has received acknowledgements from the 156 minimum number of electable peers sufficient to ensure that the effect 157 of the permanent record remains durable if an election is held. This is the default acknowledgement 158 policy. 159 </p> 160 </li> 161 </ul> 162 </div> 163 </div> 164 </div> 165 <div class="sect2" lang="en" xml:lang="en"> 166 <div class="titlepage"> 167 <div> 168 <div> 169 <h3 class="title"><a id="id1702914"></a>Errors</h3> 170 </div> 171 </div> 172 </div> 173 <p> 174 The <code class="methodname">DB_ENV->repmgr_set_ack_policy()</code> 175 <span> 176 <span> 177 method may fail and return one of the following non-zero errors: 178 </span> 179 180 </span> 181 </p> 182 <div class="sect3" lang="en" xml:lang="en"> 183 <div class="titlepage"> 184 <div> 185 <div> 186 <h4 class="title"><a id="id1702981"></a>EINVAL</h4> 187 </div> 188 </div> 189 </div> 190 <p> 191 If this method is called from a base replication API 192 application; or if an invalid flag value or parameter was 193 specified. 194 </p> 195 </div> 196 </div> 197 <div class="sect2" lang="en" xml:lang="en"> 198 <div class="titlepage"> 199 <div> 200 <div> 201 <h3 class="title"><a id="id1702979"></a>Class</h3> 202 </div> 203 </div> 204 </div> 205 <p> 206 <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a> 207 </p> 208 </div> 209 <div class="sect2" lang="en" xml:lang="en"> 210 <div class="titlepage"> 211 <div> 212 <div> 213 <h3 class="title"><a id="id1702837"></a>See Also</h3> 214 </div> 215 </div> 216 </div> 217 <p> 218 <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a> 219 </p> 220 </div> 221 </div> 222 <div class="navfooter"> 223 <hr /> 224 <table width="100%" summary="Navigation footer"> 225 <tr> 226 <td width="40%" align="left"><a accesskey="p" href="repmgrget_ack_policy.html">Prev</a>��</td> 227 <td width="20%" align="center"> 228 <a accesskey="u" href="rep.html">Up</a> 229 </td> 230 <td width="40%" align="right">��<a accesskey="n" href="repmgrlocal_site.html">Next</a></td> 231 </tr> 232 <tr> 233 <td width="40%" align="left" valign="top">DB_ENV->repmgr_get_ack_policy()��</td> 234 <td width="20%" align="center"> 235 <a accesskey="h" href="index.html">Home</a> 236 </td> 237 <td width="40%" align="right" valign="top">��DB_ENV->repmgr_set_local_site()</td> 238 </tr> 239 </table> 240 </div> 241 </body> 242</html> 243