[Zope-CMF] HCFileStorage

Glenn Pierce glenn.pierce at odconsultancy.com
Tue Aug 5 16:02:53 EDT 2003


Not sure if this is right but I believe the statement bleow in
HCFileStorage prevents packing of ( Items to be retained ) even if the
original object has been deleted, adding to wasted space ?

ppos=pindex_get(oid, 0)
if ppos != pos and not self._toBeRetained(pos,file):

I have attached a patch that seems to fix this problem.
Not sure this is the correct solution though.

sorry if this is wrong.






On Mon, 2003-08-04 at 10:10, Glenn Pierce wrote:
> For anyone with this problem the way to use HCFileStorage.
> 
> The custom_zodb file should contain something similar to the following
> 
> 
> import os,sys
> import Globals
> import ZODB.HCFileStorage
>                                                                                 
> from Products.CMFOD.WebPage import WebPage
>                                                                                 
> historyCategories = ('WebPage With History', [WebPage], 0),
> storage = ZODB.HCFileStorage.HCFileStorage(Globals.BobobaseName,
> historyCategories=historyCategories)
>                                                                                 
> DB = ZODB.DB(storage)
> 
> 
> Where WebPage is the context type for which I want to keep histories
> for.
> 
>  
> 
> 
> 
> 
> On Mon, 2003-07-28 at 15:33, Glenn Pierce wrote:
> > Hi 
> > 
> > Can anyone help me in setting up HCFileStorage
> > 
> > I have placed HCFileStorage in the ZODB directory with FileStorage
> > 
> > I have also created a custom_zodb.py with the following contents in my
> > INSTANCE_HOME
> > 
> > 
> > import Globals
> > import ZODB.HCFileStorage
> >                                                                                                                     
> > classes = ('WebPage',)
> > historyCategories = (('Content with History', classes, 10),)
> > storage = ZODB.HCFileStorage.HCFileStorage(Globals.BobobaseName,
> > historyCategories)
> >                                                                                                                  
> > DB = ZODB.DB(storage)
> > 
> > (WebPage is basically a Document with OFS.History)
> > 
> > After starting zope for the first time every thing appears to work
> > however when packing zope's db
> > I get permission errors of
> > 
> > Traceback (innermost last):
> >   File /usr/lib/zope/lib/python/ZODB/DB.py, line 499, in pack
> >   File /usr/lib/zope/lib/python/ZODB/HCFileStorage.py, line 534, in pack
> >     (Object: /var/lib/zope/instance/default/var/Data.fs)
> >   File /usr/lib/zope/lib/python/ZODB/HCFileStorage.py, line 456, in
> > _oriPack
> >     (Object: /var/lib/zope/instance/default/var/Data.fs)
> > IOError: [Errno 13] Permission denied:
> > '/var/lib/zope/instance/default/var/Data.fs'
> > 
> > 
> > Afer changing permissions on the Dat.fs which I know is no solution
> > (Just wanted to see if it would solve things)
> > 
> > I get
> > 2003-07-28T15:27:18 ERROR(200) ZODB Couldn't load state for
> > '\x00\x00\x00\x00\x00\x00\x003'
> > Traceback (innermost last):
> >   File /usr/lib/zope/lib/python/ZODB/Connection.py, line 509, in
> > setstate
> >   File /usr/lib/zope/lib/python/ZODB/FileStorage.py, line 650, in load
> >     (Object: /var/lib/zope/instance/default/var/Data.fs)
> >   File /usr/lib/zope/lib/python/ZODB/FileStorage.py, line 625, in _load
> >     (Object: /var/lib/zope/instance/default/var/Data.fs)
> > ValueError: I/O operation on closed file
> > 
> > 
> > I have no doubt that I am using HCFileStorage incorrectly as I can find
> > no examples.
> > 
> > Any help greatly appreciated.
> > 
> > Thank you
> > 
> > Glenn
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > Zope-CMF maillist  -  Zope-CMF at zope.org
> > http://mail.zope.org/mailman/listinfo/zope-cmf
> > 
> > See http://collector.zope.org/CMF for bug reports and feature requests
> > 
> 
> 
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF at python.org
> http://mail.python.org/mailman/listinfo/zope-cmf
> 
> See http://collector.zope.org/CMF for bug reports and feature requests
-------------- next part --------------
--- setup/HCFileStorage.py	2003-03-30 17:08:53.000000000 +0100
+++ ../../ZODB/HCFileStorage.py	2003-08-05 15:43:33.000000000 +0100
@@ -276,6 +276,11 @@
                         vindex[version]=opos
                     else:
                         if packing:
+
+			    if not referenced(oid):
+                        	pos=pos+dlen
+                        	continue
+
                             ppos=pindex_get(oid, 0)
                             if ppos != pos \
                                and not self._toBeRetained(pos,file):


More information about the Zope-CMF mailing list