<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple style='word-wrap: break-word;
-webkit-nbsp-mode: space;-webkit-line-break: after-white-space'>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Hello,<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I&#8217;m the product manager for Berkeley DB at
Oracle.&nbsp;&nbsp; CDS does allow multiple readers and a single writer, it
uses database level locking.&nbsp; It doesn&#8217;t provide protection from
failure or transactions and recovery.&nbsp; In other words, if your application
crashes you can&#8217;t expect the data in the database to be consistent.&nbsp;
For that you&#8217;ll need to use TDS (transactional data store).&nbsp; It
provides page level locking and ACID transactions.&nbsp; It ensures consistency
of the data even if you crash during database operations.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>You might take a minute (okay an hour) to watch these two
tutorial videos in order (first DS, then CDS, we&#8217;re working on TDS and HA
videos now).<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'><a
href="http://www.oracle.com/technology/products/berkeley-db/tutorial-berkeleydb-ds.html">http://www.oracle.com/technology/products/berkeley-db/tutorial-berkeleydb-ds.html</a><o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'><a
href="http://www.oracle.com/technology/products/berkeley-db/tutorial-berkeleydb-cds.html">http://www.oracle.com/technology/products/berkeley-db/tutorial-berkeleydb-cds.html</a><o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>I
hope that helps.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>-greg<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Jeff Johnson
[mailto:jbj@jbj.org] <br>
<b>Sent:</b> Saturday, October 03, 2009 4:53 PM<br>
<b>To:</b> Python bindings for Oracle Berkeley DB<br>
<b>Subject:</b> Re: [pybsddb] concurrent access dictionaries<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<div>

<div>

<p class=MsoNormal>On Oct 3, 2009, at 3:21 PM, Benjamin Rutt wrote:<o:p></o:p></p>

</div>

<p class=MsoNormal><br>
<br>
<o:p></o:p></p>

<p>The docs say (for the version shipped with python 2.6), in <a
href="http://www.jcea.es/programacion/pybsddb_doc/4.7.3/introduction.html#introduction">http://www.jcea.es/programacion/pybsddb_doc/4.7.3/introduction.html#introduction</a>:<br>
&nbsp;<br>
&quot;3.&nbsp; Concurrent access dictionaries: This refers to the ability to
simultaneously have one writer and multiple readers of a DB (either in multiple
threads or processes) and is implemented simply by creating a DBEnv with
certain flags. No extra work is required to allow this access mode in
bsddb3.&quot;<br>
&nbsp;<br>
Could someone elaborate on exactly which &quot;certain flags&quot; are needed
when creating the DBEnv to achieve the goal here in #3?&nbsp; Did I get it
right below (for the b-tree access method)?<o:p></o:p></p>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<p class=MsoNormal>Sure.<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal>This is the &quot;INIT_CDB&quot; model, been used by RPM for
years.<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal>Disclaimer: I don't use pybsddb nor python, but I do use
Berkeley DB<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>with INIT_CDB daily for years.<o:p></o:p></p>

</div>

<div>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'>

<p>from bsddb import db<br>
<br>
env = db.DBEnv()<br>
env.open('/some/dir', db.DB_CREATE | db.DB_THREAD | db.DB_INIT_CDB |
db.DB_INIT_MPOOL)<br>
dbh = db.DB(env)<br>
dbh.open(&quot;foo.db&quot;, None, db.DB_BTREE, db.DB_CREATE)<br>
<br clear=all>
<o:p></o:p></p>

</blockquote>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<p class=MsoNormal>These flags look right to me. Try w/o DB_THREAD if you need
a sanity check,<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>that's exactly what RPM uses. DB_THREAD is needed iff you
have threads<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal>sharing the same locks as processes.<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal>73 de Jeff<o:p></o:p></p>

</div>

</div>

</div>

</body>

</html>