[ZODB-Dev] Problems with Transactions and FileStorage size
Heiko Hees
heiko.hees@brainbot.com
Fri, 19 Jul 2002 14:12:00 +0200
Hi,
i am looking for a switch, to prevent logging of transactions, since
this seems to heavily grow file size.
if i run the following program (first run generates an object with an
array, second run changes the array an commits a 1000 times) file size
grows as follows:
heiko@julie:~/tests/persistent$ ls -al a*
-rw-r--r-- 1 heiko heiko 3158 Jul 19 14:08 a
-rw-r--r-- 1 heiko heiko 3 Jul 19 14:08 a.lock
-rw-r--r-- 1 heiko heiko 2966 Jul 19 14:08 a.tmp
heiko@julie:~/tests/persistent$ ./dbsizeTest.py a
heiko@julie:~/tests/persistent$ ls -al a*
-rw-r--r-- 1 heiko heiko 2856903 Jul 19 14:08 a
-rw-r--r-- 1 heiko heiko 3 Jul 19 14:08 a.lock
-rw-r--r-- 1 heiko heiko 2823 Jul 19 14:08 a.tmp
does anyone have a hint other than running db.pack()?
heiko
the program:
#!/usr/bin/python
import ZODB, sys,time
from Persistence import Persistent
from ZODB import FileStorage, DB
class X(Persistent):
def __init__(self):
self.a = []
for i in range(1000):
self.a.append(i)
self._p_changed = 1
def change(self):
self.a[0] +=1
self._p_changed = 1
db = DB( FileStorage.FileStorage(sys.argv[1]) )
connection = db.open()
root = connection.root()
if not root.has_key('x'):
# first run
root['x'] = X()
get_transaction().commit()
else:
# second run
for i in range(1000):
root['x'].change()
get_transaction().commit()
connection.close()
--
brainbot technologies ag
schwalbacherstr. 74 65183 wiesbaden . germany
vox +49 611 238505-0 fax ++49 611 238505-1
http://brainbot.com/ mailto:heiko@brainbot.com