Debian Codegraph @

docs/programmer_reference/am_misc_stability.html

raw symbols SCIP
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>Cursor stability</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="am_misc.html" title="Chapter 4.  Access Method Wrapup" />
11 <link rel="prev" href="am_misc_error.html" title="Error support" />
12 <link rel="next" href="am_misc_dbsizes.html" title="Database limits" />
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">Cursor stability</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="am_misc_error.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 4. 
26 Access Method Wrapup
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="am_misc_dbsizes.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="am_misc_stability"></a>Cursor stability</h2>
38 </div>
39 </div>
40 </div>
41 <p>In the absence of locking, no guarantees are made about the stability
42 of cursors in different threads of control. However, the Btree, Queue
43 and Recno access methods guarantee that cursor operations, interspersed
44 with any other operation in the same thread of control will always
45 return keys in order and will return each non-deleted key/data pair
46 exactly once. Because the Hash access method uses a dynamic hashing
47 algorithm, it cannot guarantee any form of stability in the presence of
48 inserts and deletes unless transactional locking is performed.</p>
49 <p>If locking was specified when the Berkeley DB environment was opened, but
50 transactions are not in effect, the access methods provide repeatable
51 reads with respect to the cursor. That is, a <a href="../api_reference/C/dbcget.html#dbcget_DB_CURRENT" class="olink">DB_CURRENT</a> call
52 on the cursor is guaranteed to return the same record as was returned
53 on the last call to the cursor.</p>
54 <p>In the presence of transactions, the Btree, Hash and Recno access
55 methods provide degree 3 isolation (serializable transactions). The
56 Queue access method provides degree 3 isolation with the exception that
57 it permits phantom records to appear between calls. That is, deleted
58 records are not locked, therefore another transaction may replace a
59 deleted record between two calls to retrieve it. The record would not
60 appear in the first call but would be seen by the second call. For
61 readers not enclosed in transactions, all access method calls provide
62 degree 2 isolation, that is, reads are not repeatable. A transaction
63 may be declared to run with degree 2 isolation by specifying the
64 <a href="../api_reference/C/dbcget.html#dbcget_DB_READ_COMMITTED" class="olink">DB_READ_COMMITTED</a> flag. Finally, Berkeley DB provides degree 1 isolation
65 when the <a href="../api_reference/C/dbopen.html#dbopen_DB_READ_UNCOMMITTED" class="olink">DB_READ_UNCOMMITTED</a> flag is specified; that is, reads
66 may see data modified in transactions which have not yet committed.</p>
67 <p>For all access methods, a cursor scan of the database performed within
68 the context of a transaction is guaranteed to return each key/data pair
69 once and only once, except in the following case. If, while performing
70 a cursor scan using the Hash access method, the transaction performing
71 the scan inserts a new pair into the database, it is possible that
72 duplicate key/data pairs will be returned.</p>
73 </div>
74 <div class="navfooter">
75 <hr />
76 <table width="100%" summary="Navigation footer">
77 <tr>
78 <td width="40%" align="left"><a accesskey="p" href="am_misc_error.html">Prev</a> </td>
79 <td width="20%" align="center">
80 <a accesskey="u" href="am_misc.html">Up</a>
81 </td>
82 <td width="40%" align="right"> <a accesskey="n" href="am_misc_dbsizes.html">Next</a></td>
83 </tr>
84 <tr>
85 <td width="40%" align="left" valign="top">Error support </td>
86 <td width="20%" align="center">
87 <a accesskey="h" href="index.html">Home</a>
88 </td>
89 <td width="40%" align="right" valign="top"> Database limits</td>
90 </tr>
91 </table>
92 </div>
93 </body>
94 </html>