[ZODB-Dev] FileStorage redundant pack error

Chris Withers chrisw@nipltd.com
Wed, 27 Nov 2002 14:30:15 +0000


Toby Dickenson wrote:
> 
> I currently use cron to pack some storages weekly. Occasionally I see this 
> error if a week goes by without any database changes. I was about to change 
> this script to ignore this type of error, when I realised that the current 
> approach is silly.

...and not only that it bitches, but it choose to bitch in a way that's pretty 
hard to catch, if you only want to catch that one error:

def safe_pack(object):
     try:
         object._p_jar._db._storage.pack(wait=1)
     except FileStorageError,e:
         # don't whinge if the error is only 'cos we've been packed before
         if e.args[0]!='The database has already been packed to a later time\nor 
no changes have been made since the last pack':
             raise

> Could we (eventually) consider changing this behaviour to simply return? 

Yes please.
+1
etc

> The backwards-compatability paranoia in me suggests that someone might be 
> doing things with Data.fs.old, and assuming that a successful pack indicates 
> that one will have been created. Any other reasons against?

hmmm... if it didn't raise the error, would it replace the Data.fs.old with one 
that was, in effect, identicaly to Data.fs? I can see that being 'bad' in some 
situations.

Maybe a flag that lets you choose between creating Data.fs.old.x or just blidnly 
creating a Data.fs.old?

cheers,

Chris