[ZODB-Dev] Re: [Zope-Checkins] CVS: ZODB3/ZODB/FileStorage - fspack.py:1.3

Dieter Maurer dieter at handshake.de
Tue Jan 20 13:48:08 EST 2004


Toby Dickenson wrote at 2004-1-19 08:18 +0000:
>
>> +            raise FileStorageError(
>> +                "The database has already been packed to a later time"
>> +                " or no changes have been made since the last pack")
>
>In the past Ive found it counterproductive for applications to have to deal 
>with this exception.
>
>If we want to leave FileStorage raising an exception in this case, perhaps 
>DB.pack could catch and swallow a RedundantPackError?

+1

It will even make the code easier (at we do not need to be so strict
with checking for "illegal redundancy".

I use:


    def buildPackIndex(self):
        ....
        if not unpacked:
            # the exception is used to communicate that nothing needs
            # to be done -- it should be catched above in the call chain
            raise _NothingToDo

	# The standard code has here quite complex code to
	# read the next transaction record and check, whether it, too,
	# is a packed transaction or does not exist.

    def findReachableAtPacktime(self, roots):

    ....
    def pack(self):
        ....
        try:
            self.gc.findReachable()
        except _NothingToDo:
            LOG("FS pack", INFO, "The pack operation has nothing to do")
            return

-- 
Dieter



More information about the ZODB-Dev mailing list