[Zodb-checkins] CVS: ZODB3/Doc/zodb - about.html:1.2.6.13 contents.html:1.2.6.13 index.html:1.2.6.13 node2.html:1.2.6.13 node3.html:1.2.6.13 node5.html:1.2.6.13 node6.html:1.2.6.13 node7.html:1.2.6.13 node8.html:1.2.6.13 zeo.html:1.2.6.13 zodb.html:1.2.6.13

Tim Peters tim.one at comcast.net
Mon Mar 7 13:51:39 EST 2005


Update of /cvs-repository/ZODB3/Doc/zodb
In directory cvs.zope.org:/tmp/cvs-serv16707/Doc/zodb

Modified Files:
      Tag: Zope-2_7-branch
	about.html contents.html index.html node2.html node3.html 
	node5.html node6.html node7.html node8.html zeo.html zodb.html 
Log Message:
Backport doc changes about __del__ methods from ZODB 3.3.

The 3.3 docs were changed to warn against using __del__ methods in
January of 2004, but those changes weren't copied into the 3.2-line docs.


=== ZODB3/Doc/zodb/about.html 1.2.6.12 => 1.2.6.13 ===
--- ZODB3/Doc/zodb/about.html:1.2.6.12	Mon Feb 28 18:34:36 2005
+++ ZODB3/Doc/zodb/about.html	Mon Mar  7 13:51:38 2005
@@ -47,7 +47,7 @@
 About this document ...</A>
 </H1>
  <strong>ZODB/ZEO Programming Guide</strong>,
-February 28, 2005, Release 3.2.6b1
+March 7, 2005, Release 3.2.6b1
 <p> This document was generated using the <a
     href="http://saftsack.fs.uni-bayreuth.de/~latex2ht/">
     <strong>LaTeX</strong>2<tt>HTML</tt></a> translator.
@@ -103,7 +103,7 @@
 </div>
 </div>
 <hr />
-<span class="release-info">Release 3.2.6b1, documentation updated on February 28, 2005.</span>
+<span class="release-info">Release 3.2.6b1, documentation updated on March 7, 2005.</span>
 </DIV>
 <!--End of Navigation Panel-->
 


=== ZODB3/Doc/zodb/contents.html 1.2.6.12 => 1.2.6.13 ===
--- ZODB3/Doc/zodb/contents.html:1.2.6.12	Mon Feb 28 18:34:36 2005
+++ ZODB3/Doc/zodb/contents.html	Mon Mar  7 13:51:38 2005
@@ -150,7 +150,7 @@
 </div>
 </div>
 <hr />
-<span class="release-info">Release 3.2.6b1, documentation updated on February 28, 2005.</span>
+<span class="release-info">Release 3.2.6b1, documentation updated on March 7, 2005.</span>
 </DIV>
 <!--End of Navigation Panel-->
 


=== ZODB3/Doc/zodb/index.html 1.2.6.12 => 1.2.6.13 ===
--- ZODB3/Doc/zodb/index.html:1.2.6.12	Mon Feb 28 18:34:36 2005
+++ ZODB3/Doc/zodb/index.html	Mon Mar  7 13:51:38 2005
@@ -45,7 +45,7 @@
 <p><b><font size="+2">A.M. Kuchling</font></b></p>
 <p><span class="email">amk at amk.ca</span></p>
 <p><strong>Release 3.2.6b1</strong><br />
-<strong>February 28, 2005</strong></p>
+<strong>March 7, 2005</strong></p>
 <p></p>
 </div>
 </div>
@@ -80,6 +80,7 @@
 <LI><A href="node3.html#SECTION000351000000000000000">2.5.1 Modifying Mutable Objects</a>
 <LI><A href="node3.html#SECTION000352000000000000000">2.5.2 Some Special Methods Don't Work</a>
 <LI><A href="node3.html#SECTION000353000000000000000">2.5.3 <tt class="method">__getattr__</tt>, <tt class="method">__delattr__</tt>, and <tt class="method">__setattr__</tt></a>
+<LI><A href="node3.html#SECTION000354000000000000000">2.5.4 <tt class="method">__del__</tt> methods</a>
 </ul>
 <LI><A href="node3.html#SECTION000360000000000000000">2.6 Writing Persistent Classes</a>
 <UL>
@@ -162,7 +163,7 @@
 </div>
 </div>
 <hr />
-<span class="release-info">Release 3.2.6b1, documentation updated on February 28, 2005.</span>
+<span class="release-info">Release 3.2.6b1, documentation updated on March 7, 2005.</span>
 </DIV>
 <!--End of Navigation Panel-->
 


=== ZODB3/Doc/zodb/node2.html 1.2.6.12 => 1.2.6.13 ===
--- ZODB3/Doc/zodb/node2.html:1.2.6.12	Mon Feb 28 18:34:36 2005
+++ ZODB3/Doc/zodb/node2.html	Mon Mar  7 13:51:38 2005
@@ -335,7 +335,7 @@
 </div>
 </div>
 <hr />
-<span class="release-info">Release 3.2.6b1, documentation updated on February 28, 2005.</span>
+<span class="release-info">Release 3.2.6b1, documentation updated on March 7, 2005.</span>
 </DIV>
 <!--End of Navigation Panel-->
 


=== ZODB3/Doc/zodb/node3.html 1.2.6.12 => 1.2.6.13 ===
--- ZODB3/Doc/zodb/node3.html:1.2.6.12	Mon Feb 28 18:34:36 2005
+++ ZODB3/Doc/zodb/node3.html	Mon Mar  7 13:51:38 2005
@@ -65,6 +65,7 @@
 <LI><A href="node3.html#SECTION000351000000000000000">2.5.1 Modifying Mutable Objects</a>
 <LI><A href="node3.html#SECTION000352000000000000000">2.5.2 Some Special Methods Don't Work</a>
 <LI><A href="node3.html#SECTION000353000000000000000">2.5.3 <tt class="method">__getattr__</tt>, <tt class="method">__delattr__</tt>, and <tt class="method">__setattr__</tt></a>
+<LI><A href="node3.html#SECTION000354000000000000000">2.5.4 <tt class="method">__del__</tt> methods</a>
 </ul>
 <LI><A href="node3.html#SECTION000360000000000000000">2.6 Writing Persistent Classes</a>
 <UL>
@@ -414,9 +415,19 @@
 <P>
 </LI>
 <LI>Recent versions of the ZODB allow writing a class with 
-<tt class="method">__setattr__</tt> , <tt class="method">__getattr__</tt>, or <tt class="method">__delattr__</tt> methods.  (Older versions didn't support this at all.)
+<tt class="method">__setattr__</tt> , <tt class="method">__getattr__</tt>, or <tt class="method">__delattr__</tt> methods.
+(Older versions didn't support this at all.)
 If you write such a <tt class="method">__setattr__</tt> or <tt class="method">__delattr__</tt> method, 
-its code has to set the dirty bit manually, 
+its code has to set the dirty bit manually.
+
+<P>
+</LI>
+<LI>A persistent class should not have a <tt class="method">__del__</tt> method.
+The database moves objects freely between memory and storage.  If an
+object has not been used in a while, it may be released and its
+contents loaded from storage the next time it is used.  Since the
+Python interpreter is unaware of persistence, it would call
+<tt class="method">__del__</tt> each time the object was freed.
 
 <P>
 </LI>
@@ -556,6 +567,46 @@
 
 <P>
 
+<H3><A NAME="SECTION000354000000000000000">
+2.5.4 <tt class="method">__del__</tt> methods</A>
+</H3>
+
+<P>
+A <tt class="method">__del__</tt> method is invoked just before the memory occupied by an
+unreferenced Python object is freed.  Because ZODB may materialize, and
+dematerialize, a given persistent object in memory any number of times,
+there isn't a meaningful relationship between when a persistent object's
+<tt class="method">__del__</tt> method gets invoked and any natural aspect of a
+persistent object's life cycle.  For example, it is emphatically not the
+case that a persistent object's <tt class="method">__del__</tt> method gets invoked only
+when the object is no longer referenced by other objects in the database.
+<tt class="method">__del__</tt> is only concerned with reachability from objects in
+memory.
+
+<P>
+Worse, a <tt class="method">__del__</tt> method can interfere with the persistence
+machinery's goals.  For example, some number of persistent objects reside
+in a <tt class="class">Connection</tt>'s memory cache.  At various times, to reduce memory
+burden, objects that haven't been referenced recently are removed from the
+cache.  If a persistent object with a <tt class="method">__del___</tt> method is so
+removed, and the cache was holding the last memory reference to the object,
+the object's <tt class="method">__del__</tt> method will be invoked.  If the
+<tt class="method">__del__</tt> method then references any attribute of the object, ZODB
+needs to load the object from the database again, in order to satisfy the
+attribute reference.  This puts the object back into the cache again:  such
+an object is effectively immortal, occupying space in the memory cache
+forever, as every attempt to remove it from cache puts it back into the
+cache.  In ZODB versions prior to 3.2.2, this could even cause the cache
+reduction code to fall into an infinite loop.  The infinite loop no longer
+occurs, but such objects continue to live in the memory cache forever.
+
+<P>
+Because <tt class="method">__del__</tt> methods don't make good sense for persistent
+objects, and can create problems, persistent classes should not define
+<tt class="method">__del__</tt> methods.
+
+<P>
+
 <H2><A NAME="SECTION000360000000000000000">
 2.6 Writing Persistent Classes</A>
 </H2>
@@ -643,7 +694,7 @@
 </div>
 </div>
 <hr />
-<span class="release-info">Release 3.2.6b1, documentation updated on February 28, 2005.</span>
+<span class="release-info">Release 3.2.6b1, documentation updated on March 7, 2005.</span>
 </DIV>
 <!--End of Navigation Panel-->
 


=== ZODB3/Doc/zodb/node5.html 1.2.6.12 => 1.2.6.13 ===
--- ZODB3/Doc/zodb/node5.html:1.2.6.12	Mon Feb 28 18:34:36 2005
+++ ZODB3/Doc/zodb/node5.html	Mon Mar  7 13:51:38 2005
@@ -179,7 +179,7 @@
 After you call <tt class="method">undo()</tt> you must commit the transaction for the
 undo to actually be applied.
 <A NAME="tex2html2"
-  HREF="#foot589"><SUP>2</SUP></A>  There is one glitch in the undo process.  The thread
+  HREF="#foot616"><SUP>2</SUP></A>  There is one glitch in the undo process.  The thread
 that calls undo may not see the changes to the object until it calls
 <tt class="method">Connection.sync()</tt> or commits another transaction.
 
@@ -263,7 +263,7 @@
 <P>
 <BR><HR><H4>Footnotes</H4>
 <DL>
-<DT><A NAME="foot589">... applied.</A><A
+<DT><A NAME="foot616">... applied.</A><A
  HREF="node5.html#tex2html2"><SUP>2</SUP></A></DT>
 <DD>There are actually two different ways a storage can
 implement the undo feature.  Most of the storages that ship with ZODB
@@ -306,7 +306,7 @@
 </div>
 </div>
 <hr />
-<span class="release-info">Release 3.2.6b1, documentation updated on February 28, 2005.</span>
+<span class="release-info">Release 3.2.6b1, documentation updated on March 7, 2005.</span>
 </DIV>
 <!--End of Navigation Panel-->
 


=== ZODB3/Doc/zodb/node6.html 1.2.6.12 => 1.2.6.13 ===
--- ZODB3/Doc/zodb/node6.html:1.2.6.12	Mon Feb 28 18:34:36 2005
+++ ZODB3/Doc/zodb/node6.html	Mon Mar  7 13:51:38 2005
@@ -480,7 +480,7 @@
 </div>
 </div>
 <hr />
-<span class="release-info">Release 3.2.6b1, documentation updated on February 28, 2005.</span>
+<span class="release-info">Release 3.2.6b1, documentation updated on March 7, 2005.</span>
 </DIV>
 <!--End of Navigation Panel-->
 


=== ZODB3/Doc/zodb/node7.html 1.2.6.12 => 1.2.6.13 ===
--- ZODB3/Doc/zodb/node7.html:1.2.6.12	Mon Feb 28 18:34:36 2005
+++ ZODB3/Doc/zodb/node7.html	Mon Mar  7 13:51:38 2005
@@ -116,7 +116,7 @@
 </div>
 </div>
 <hr />
-<span class="release-info">Release 3.2.6b1, documentation updated on February 28, 2005.</span>
+<span class="release-info">Release 3.2.6b1, documentation updated on March 7, 2005.</span>
 </DIV>
 <!--End of Navigation Panel-->
 


=== ZODB3/Doc/zodb/node8.html 1.2.6.12 => 1.2.6.13 ===
--- ZODB3/Doc/zodb/node8.html:1.2.6.12	Mon Feb 28 18:34:36 2005
+++ ZODB3/Doc/zodb/node8.html	Mon Mar  7 13:51:38 2005
@@ -575,7 +575,7 @@
 </div>
 </div>
 <hr />
-<span class="release-info">Release 3.2.6b1, documentation updated on February 28, 2005.</span>
+<span class="release-info">Release 3.2.6b1, documentation updated on March 7, 2005.</span>
 </DIV>
 <!--End of Navigation Panel-->
 


=== ZODB3/Doc/zodb/zeo.html 1.2.6.12 => 1.2.6.13 ===
--- ZODB3/Doc/zodb/zeo.html:1.2.6.12	Mon Feb 28 18:34:36 2005
+++ ZODB3/Doc/zodb/zeo.html	Mon Mar  7 13:51:38 2005
@@ -120,7 +120,7 @@
 database all the time, this will result in a storm of invalidate
 messages being sent, and this might take up more processing time than
 the actual database operations themselves.<A NAME="tex2html1"
-  HREF="#foot433"><SUP>1</SUP></A>
+  HREF="#foot460"><SUP>1</SUP></A>
 <P>
 On the other hand, for applications that have few writes in comparison
 to the number of read accesses, this aggressive caching can be a major
@@ -379,7 +379,7 @@
 <P>
 <BR><HR><H4>Footnotes</H4>
 <DL>
-<DT><A NAME="foot433">... themselves.</A><A
+<DT><A NAME="foot460">... themselves.</A><A
  href="zeo.html#tex2html1"><SUP>1</SUP></A></DT>
 <DD>These messages are
 small and sent in batches, so there would need to be a lot of writes
@@ -420,7 +420,7 @@
 </div>
 </div>
 <hr />
-<span class="release-info">Release 3.2.6b1, documentation updated on February 28, 2005.</span>
+<span class="release-info">Release 3.2.6b1, documentation updated on March 7, 2005.</span>
 </DIV>
 <!--End of Navigation Panel-->
 


=== ZODB3/Doc/zodb/zodb.html 1.2.6.12 => 1.2.6.13 ===
--- ZODB3/Doc/zodb/zodb.html:1.2.6.12	Mon Feb 28 18:34:36 2005
+++ ZODB3/Doc/zodb/zodb.html	Mon Mar  7 13:51:38 2005
@@ -45,7 +45,7 @@
 <p><b><font size="+2">A.M. Kuchling</font></b></p>
 <p><span class="email">amk at amk.ca</span></p>
 <p><strong>Release 3.2.6b1</strong><br />
-<strong>February 28, 2005</strong></p>
+<strong>March 7, 2005</strong></p>
 <p></p>
 </div>
 </div>
@@ -80,6 +80,7 @@
 <LI><A href="node3.html#SECTION000351000000000000000">2.5.1 Modifying Mutable Objects</a>
 <LI><A href="node3.html#SECTION000352000000000000000">2.5.2 Some Special Methods Don't Work</a>
 <LI><A href="node3.html#SECTION000353000000000000000">2.5.3 <tt class="method">__getattr__</tt>, <tt class="method">__delattr__</tt>, and <tt class="method">__setattr__</tt></a>
+<LI><A href="node3.html#SECTION000354000000000000000">2.5.4 <tt class="method">__del__</tt> methods</a>
 </ul>
 <LI><A href="node3.html#SECTION000360000000000000000">2.6 Writing Persistent Classes</a>
 <UL>
@@ -162,7 +163,7 @@
 </div>
 </div>
 <hr />
-<span class="release-info">Release 3.2.6b1, documentation updated on February 28, 2005.</span>
+<span class="release-info">Release 3.2.6b1, documentation updated on March 7, 2005.</span>
 </DIV>
 <!--End of Navigation Panel-->
 



More information about the Zodb-checkins mailing list