| 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>Transaction limits</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="txn.html" title="Chapter 19. The Transaction Subsystem" /> |
| 11 | <link rel="prev" href="txn_config.html" title="Configuring transactions" /> |
| 12 | <link rel="next" href="sequence.html" title="Chapter 20. Sequences" /> |
| 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">Transaction limits</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="txn_config.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 19. |
| 26 | The Transaction Subsystem |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="sequence.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="txn_limits"></a>Transaction limits</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <div class="toc"> |
| 42 | <dl> |
| 43 | <dt> |
| 44 | <span class="sect2"> |
| 45 | <a href="txn_limits.html#idp53352320">Transaction IDs</a> |
| 46 | </span> |
| 47 | </dt> |
| 48 | <dt> |
| 49 | <span class="sect2"> |
| 50 | <a href="txn_limits.html#idp53275624">Cursors</a> |
| 51 | </span> |
| 52 | </dt> |
| 53 | <dt> |
| 54 | <span class="sect2"> |
| 55 | <a href="txn_limits.html#idp53223368">Multiple Threads of Control</a> |
| 56 | </span> |
| 57 | </dt> |
| 58 | </dl> |
| 59 | </div> |
| 60 | <div class="sect2" lang="en" xml:lang="en"> |
| 61 | <div class="titlepage"> |
| 62 | <div> |
| 63 | <div> |
| 64 | <h3 class="title"><a id="idp53352320"></a>Transaction IDs</h3> |
| 65 | </div> |
| 66 | </div> |
| 67 | </div> |
| 68 | <p>Transactions are identified by 31-bit unsigned integers, which means |
| 69 | there are just over two billion unique transaction IDs. When a database |
| 70 | environment is initially created or recovery is run, the transaction ID |
| 71 | name space is reset, and new transactions are numbered starting from |
| 72 | 0x80000000 (2,147,483,648). The IDs will wrap if the maximum |
| 73 | transaction ID is reached, starting again from 0x80000000. The most |
| 74 | recently allocated transaction ID is the <span class="bold"><strong>st_last_txnid</strong></span> value in |
| 75 | the transaction statistics information, and can be displayed by the |
| 76 | <a href="../api_reference/C/db_stat.html" class="olink">db_stat</a> utility.</p> |
| 77 | </div> |
| 78 | <div class="sect2" lang="en" xml:lang="en"> |
| 79 | <div class="titlepage"> |
| 80 | <div> |
| 81 | <div> |
| 82 | <h3 class="title"><a id="idp53275624"></a>Cursors</h3> |
| 83 | </div> |
| 84 | </div> |
| 85 | </div> |
| 86 | <p>When using transactions, cursors are localized to a single transaction. |
| 87 | That is, a cursor may not span transactions, and must be opened and |
| 88 | closed within a single transaction. In addition, intermingling |
| 89 | transaction-protected cursor operations and non-transaction-protected |
| 90 | cursor operations on the same database in a single thread of control is |
| 91 | practically guaranteed to deadlock because the locks obtained for |
| 92 | transactions and non-transactions can conflict.</p> |
| 93 | </div> |
| 94 | <div class="sect2" lang="en" xml:lang="en"> |
| 95 | <div class="titlepage"> |
| 96 | <div> |
| 97 | <div> |
| 98 | <h3 class="title"><a id="idp53223368"></a>Multiple Threads of Control</h3> |
| 99 | </div> |
| 100 | </div> |
| 101 | </div> |
| 102 | <p>Because transactions must hold all their locks until commit, a single |
| 103 | transaction may accumulate a large number of long-term locks during its |
| 104 | lifetime. As a result, when two concurrently running transactions |
| 105 | access the same database, there is strong potential for conflict. |
| 106 | Although Berkeley DB allows an application to have multiple outstanding |
| 107 | transactions active within a single thread of control, great care must |
| 108 | be taken to ensure that the transactions do not block each other (for |
| 109 | example, attempt to obtain conflicting locks on the same data). If two |
| 110 | concurrently active transactions in the same thread of control do |
| 111 | encounter a lock conflict, the thread of control will deadlock so that |
| 112 | the deadlock detector cannot detect the problem. In this case, there |
| 113 | is no true deadlock, but because the transaction on which a transaction |
| 114 | is waiting is in the same thread of control, no forward progress can be |
| 115 | made.</p> |
| 116 | </div> |
| 117 | </div> |
| 118 | <div class="navfooter"> |
| 119 | <hr /> |
| 120 | <table width="100%" summary="Navigation footer"> |
| 121 | <tr> |
| 122 | <td width="40%" align="left"><a accesskey="p" href="txn_config.html">Prev</a> </td> |
| 123 | <td width="20%" align="center"> |
| 124 | <a accesskey="u" href="txn.html">Up</a> |
| 125 | </td> |
| 126 | <td width="40%" align="right"> <a accesskey="n" href="sequence.html">Next</a></td> |
| 127 | </tr> |
| 128 | <tr> |
| 129 | <td width="40%" align="left" valign="top">Configuring transactions </td> |
| 130 | <td width="20%" align="center"> |
| 131 | <a accesskey="h" href="index.html">Home</a> |
| 132 | </td> |
| 133 | <td width="40%" align="right" valign="top"> Chapter 20. |
| 134 | Sequences |
| 135 | </td> |
| 136 | </tr> |
| 137 | </table> |
| 138 | </div> |
| 139 | </body> |
| 140 | </html> |