Puzzled by BoboPOS
Hi: I recently took a closer look at BoboPOS operation, and I am puzzled: a pack operation doesn't seem to remove obsolete instances (even though it compresses the db significantly.) My applications work as expected, but the db size increases unnecessarily over time. Below is a simple application I use to test this. I would expect that, after a pack, only 1 Timestamp instance would be in the db, as only 1 can be reached from the root object at any time. Instead, I noticed that obsolete Timestamp instances are still present. Can someone tell me why? Platform: Sun Solaris
import os, sys path = os.path lib, tail = path.split(__file__) import DocumentTemplate import BoboPOS import time datadir = path.join(lib, 'var', 'Data') class Container(BoboPOS.Persistent): """ Container """ def __init__(self): """ init """ self._timestamp = None def index_html(self): """ default method """ if self._timestamp is not None: return self._timestamp._time return 'No timestamp' def pack(self): """ pack database """ db._jar.db.pack(None, 0) return 'pack OK' def clear(self): """ clear """ self._timestamp = None return self.index_html() def stamp(self): """ stamp """ self._timestamp = Timestamp() return self.index_html() class Timestamp(BoboPOS.Persistent): """ Item """ def __init__(self): """ init """ self._time = time.ctime(time.time()) db = BoboPOS.PickleDictionary(path.join(datadir, 'tsdb')) if db.has_key('Container'): bobo_application = db['Container'] else: bobo_application = db['Container'] = Container() get_transaction().commit() <<< -- =================================================================== Jan Decaluwe === Easics === Design Manager === VHDL-based ASIC design services === Tel: +32-16-395 600 =================================== Fax: +32-16-395 619 Interleuvenlaan 86, B-3001 Leuven, BELGIUM mailto:jand@easics.be http://www.easics.com
On Tue, 6 Apr 1999, Jan Decaluwe wrote:
be in the db, as only 1 can be reached from the root object at any time. Instead, I noticed that obsolete Timestamp instances are still present. Can someone tell me why?
The code describes a container object that holds only one timestamp. How are the additional timestamp objects added in your container? Pavlos
Pavlos Christoforou wrote:
On Tue, 6 Apr 1999, Jan Decaluwe wrote:
be in the db, as only 1 can be reached from the root object at any time. Instead, I noticed that obsolete Timestamp instances are still present. Can someone tell me why?
The code describes a container object that holds only one timestamp. How are the additional timestamp objects added in your container?
Pavlos
They are not. By subsequent calls of the published method "stamp", the single timestamp object in the container is overridden by a newly created one. However, all timestamps are added to the BoboPOS db on disk. This is also as expected, because the db is a multiple revision db. My problem is that after a pack operation on the BoboPOS db, the non-current timestamps are *still* present in the db, even though they don't seem to be reachable from the root Container object. As a result, the db keeps growing, while I would expect it to have a constant size (after a pack). Jan -- =================================================================== Jan Decaluwe === Easics === Design Manager === VHDL-based ASIC design services === Tel: +32-16-395 600 =================================== Fax: +32-16-395 619 Interleuvenlaan 86, B-3001 Leuven, BELGIUM mailto:jand@easics.be http://www.easics.com
participants (2)
-
Jan Decaluwe -
Pavlos Christoforou