Hi All,

I've been chatting with Shane about this off-list but wanted to see if anyone else has experience of this and has found a solution.

So, the problem is that, with a Zope 2 app server, any revisions made to an object (say, a Page Template) don't show in the history tab of that object *until* the app server is restarted.

I've verified this on both MySQL and Postgres with trunk of RelStorage as well as 1.5.2 and 1.4.2. It appears to be some kind of cursor re-use / relational database transaction isolation bug given that the following hack fixes the problem:

--- a/relstorage/storage.py
+++ b/relstorage/storage.py
@@ -1025,7 +1025,7 @@ class RelStorage(
-            cursor = self._load_cursor
+            conn, cursor = self._adapter.connmanager.open()
             oid_int = u64(oid)
                 rows = self._adapter.dbiter.iter_object_history(
@@ -1053,6 +1053,7 @@ class RelStorage(
             return res
+            self._adapter.connmanager.close(conn, cursor)

It seems a little heavyweight to have to open a whole new connection each time someone views a history tab, though :-/

A couple of surprising things:

- ZODB.tests.HistoryStorage:HistoryStorage.checkSimpleHistory passes. I'd expect this to fail, so I wonder what it's doing differently?

- The read connection is obviously getting the transaction's data, otherwise the wrong version of the object would be rendered, right?

Any ideas very gratefully received...



Simplistix - Content Management, Batch Processing & Python Consulting
            - http://www.simplistix.co.uk
For more information about ZODB, see http://zodb.org/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to