libdb/docs/programmer_reference/txn_config.html

92 lines
4.5 KiB
HTML
Raw Normal View History

2011-09-13 17:44:24 +00:00
<?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>Configuring transactions</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 Programmer's Reference Guide" />
<link rel="up" href="txn.html" title="Chapter 19.  The Transaction Subsystem" />
<link rel="prev" href="txn.html" title="Chapter 19.  The Transaction Subsystem" />
<link rel="next" href="txn_limits.html" title="Transaction limits" />
</head>
<body>
<div xmlns="" class="navheader">
<div class="libver">
<p>Library Version 11.2.5.2</p>
</div>
<table width="100%" summary="Navigation header">
<tr>
<th colspan="3" align="center">Configuring transactions</th>
</tr>
<tr>
<td width="20%" align="left"><a accesskey="p" href="txn.html">Prev</a> </td>
<th width="60%" align="center">Chapter 19. 
The Transaction Subsystem
</th>
<td width="20%" align="right"> <a accesskey="n" href="txn_limits.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="txn_config"></a>Configuring transactions</h2>
</div>
</div>
</div>
<p>The application may change the number of simultaneous outstanding
transactions supported by the Berkeley DB environment by calling the
<a href="../api_reference/C/envset_tx_max.html" class="olink">DB_ENV-&gt;set_tx_max()</a> method. This will also set the size of the
underlying transaction subsystem's region. When the number of
outstanding transactions is reached, additional calls to
<a href="../api_reference/C/txnbegin.html" class="olink">DB_ENV-&gt;txn_begin()</a> will fail until some active transactions complete.</p>
<p>The application can limit how long a transaction runs or blocks on
contested resources.
The <a href="../api_reference/C/envset_timeout.html" class="olink">DB_ENV-&gt;set_timeout()</a> method specifies the length of the timeout.
This value is checked whenever deadlock detection is performed or
when the transaction is about to block on a lock that cannot be
immediately granted.
Because timeouts are only checked at these times, the accuracy of the
timeout depends on how often deadlock detection is performed or how
frequently the transaction blocks.</p>
<p>There is an additional parameter used in configuring transactions; the
<a href="../api_reference/C/envset_flags.html#envset_flags_DB_TXN_NOSYNC" class="olink">DB_TXN_NOSYNC</a>. Setting the <a href="../api_reference/C/envset_flags.html#envset_flags_DB_TXN_NOSYNC" class="olink">DB_TXN_NOSYNC</a> flag to
<a href="../api_reference/C/envset_flags.html" class="olink">DB_ENV-&gt;set_flags()</a> when opening a transaction region changes the
behavior of transactions to not write or synchronously flush the log
during transaction commit.</p>
<p>This change may significantly increase application transactional
throughput. However, it means that although transactions will continue
to exhibit the ACI (atomicity, consistency, and isolation) properties,
they will not have D (durability). Database integrity will be
maintained, but it is possible that some number of the most recently
committed transactions may be undone during recovery instead of being
redone.</p>
</div>
<div class="navfooter">
<hr />
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left"><a accesskey="p" href="txn.html">Prev</a> </td>
<td width="20%" align="center">
<a accesskey="u" href="txn.html">Up</a>
</td>
<td width="40%" align="right"> <a accesskey="n" href="txn_limits.html">Next</a></td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Chapter 19. 
The Transaction Subsystem
 </td>
<td width="20%" align="center">
<a accesskey="h" href="index.html">Home</a>
</td>
<td width="40%" align="right" valign="top"> Transaction limits</td>
</tr>
</table>
</div>
</body>
</html>