[Zope-CVS] CVS: Products/BTreeFolder2 - BTreeFolder2.py:1.19
jace at pobox.com
Sat Jan 10 11:02:35 EST 2004
Update of /cvs-repository/Products/BTreeFolder2
In directory cvs.zope.org:/tmp/cvs-serv19862
Added a manage_fixCount method to fix the self._count counter after recovery
from data corruption. I have a BTreeFolder2 instance here that says the count
is 14552 but actually has only 12861 items.
=== Products/BTreeFolder2/BTreeFolder2.py 1.18 => 1.19 ===
--- Products/BTreeFolder2/BTreeFolder2.py:1.18 Mon Dec 29 18:27:34 2003
+++ Products/BTreeFolder2/BTreeFolder2.py Sat Jan 10 11:02:35 2004
@@ -107,6 +107,34 @@
+ def manage_fixCount(self):
+ """Calls self._fixCount() and reports the result as text.
+ old, new = self._fixCount()
+ path = '/'.join(self.getPhysicalPath())
+ if old==new:
+ return "No count mismatch detected in BTreeFolder2 at %s."\
+ % path
+ return ("Fixed count mismatch in BTreeFolder2 at %s. "
+ "Count was %d; corrected to %d" % (path, old, new))
+ def _fixCount(self):
+ """Checks if the value of self._count disagrees with
+ len(self.objectIds()). If so, corrects self._count. Returns the
+ old and new count values. If old==new, no correction was
+ old = self._count()
+ new = len(self.objectIds())
+ if old != new:
+ return old, new
"""Calls self._cleanup() and reports the result as text.
More information about the Zope-CVS