|
|
|
Finding the last changed object in a ZODB.Today I had to figure out why something that should not create a write
transaction did create one.
The first step is easy, you pack the database, do the thing that should not modify anything and look in the "undo" tab of your Zope site. There you'll see if something was written or not, it comes up as an undoable transaction. Then it is a matter of figuring out what happens. In this case, it was quite a complex script with many parts. I wanted to see if I could narrow down the problem by seeing what was actually changed. So, from my lib/python directory, I ran this script:
from ZODB.FileStorage import FileStorage
storage = FileStorage('/path/to/var/Data.fs', read_only=1)
iter = storage.iterator()
try:
while True:
transaction = iter.next()
except:
pass
for rec in transaction:
print repr(rec.oid)
This prints out the "oids" of all modified objects in the transaction.Then I can run zope in debug mode: bin/zopectl debugWhen I get the python prompt, I can get the objects that were modified: app._p_jar['the oid pasted from the previous script']This allowed me to narrow down the search for the culprit quite a lot. It still remains to figure out where in the code the modification is, but at least with the above you can get a rough idea of what is happening. See also Debugging ZODB bloat which documents roughly this process. Important announcement: Join the Nuxeo team and contribute to the Nuxeo project! We have open positions in France and the UK for open source Java EE developers and sales engineers, both junior and senior.
Posted by Lennart Regebro @ 06/28/2006 04:19 PM.
-
Categories:
zope
-
0 comments
|
Nuxeo Bloggers: Log in! Search Nuxeo Blogs
About this blog
Lennart Regebro
Nuxeo Bloggers
Photos and Pictures
|
|
Nuxeo -
Indesko -
Nuxeo 5 Project
All content is copyrighted by their author. CPSSkins is Copyright © 2003-2006 by Jean-Marc Orliaguet. | CPS is Copyright © 2002-2006 by Nuxeo SAS. |