Search code examples
plonepackingzodb

Why is Data.fs.old disappearing?


I am testing the packing-mechanism, therefore setted pack-days to zero, added and removed objects via ZMI to generate some history, and execute zeopack, which works fine so far.

Yet, if there hasn't been any transactions since the last packing, and another new packing is triggered, the Data.fs.old is deleted/disappears, why?

Respectively, which codelines are doing that? Cannot find it somehow.


Solution

  • Starting a pack always removes the .old file.

    When there then is nothing to pack, no new .old file is created in it's place.

    See the FileStorage.pack() method; it deletes an existing .old file right after acquiring the packing lock.

    The logic goes (with some indentation and intermediary code removed):

    oldpath = self._file_name + ".old"
    if os.path.exists(oldpath):
        os.remove(oldpath)
    
    # collect pack info
    pack_result = self.packer(self, referencesf, stop, gc)
    
    if pack_result is None:
        return
    
    os.rename(self._file_name, oldpath)