RE: [ZODB-Dev] ZEO and setting instance variables in __getstate__

2005-12-30 Thread Tim Peters
[Syver Enstad]
>>> I have recently upgraded from ZODB 3.2 to 3.5.1. After doing this I
>>> notice that ZEO throws exceptions on commiting a transaction for
>>> certain types of Persistent classes. ...

[Tim Peters]
>> I was able to create a small self-contained test case from this
>> description, and opened a Collector issue containing it:
>>
>> http://www.zope.org/Collectors/Zope3-dev/526
>>
>> As it says, I don't know whether it "should work", but offhand don't see
>> why not.  As is, creating new state inside __getstate__ is confusing the
>> heck out of ZEO's MVCC cache "for some reason".

[Syver Enstad]
> I noticed that the collector issue source file has a comment that this is
> experienced on windows. My testing has been done on Linux Ubuntu Breezy
> Badger and I get the same error, (cur_tid < tid) fails there too.

The comment says specifically that cur_tid == tid on Windows, not just that
cur_tid < tid fails.  While they're probably equal on your box too, timing
functions on Windows have such radically different pragmatics that I'm not
assuming that.  If they are equal on your box, please add a comment to the
Collector issue saying so (comments on zodb-dev will soon be forgotten).

___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


Re: [ZODB-Dev] ZEO and setting instance variables in __getstate__

2005-12-30 Thread Syver Enstad

Tim Peters wrote:

[Syver Enstad]


I have recently upgraded from ZODB 3.2 to 3.5.1. After doing this I
notice that ZEO throws exceptions on commiting a transaction for certain
types of Persistent classes.
...



I was able to create a small self-contained test case from this description,
and opened a Collector issue containing it:

http://www.zope.org/Collectors/Zope3-dev/526

As it says, I don't know whether it "should work", but offhand don't see why
not.  As is, creating new state inside __getstate__ is confusing the heck
out of ZEO's MVCC cache "for some reason".


I noticed that the collector issue source file has a comment that this 
is experienced on windows. My testing has been done on Linux Ubuntu 
Breezy Badger and I get the same error, (cur_tid < tid) fails there too.

___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


RE: [ZODB-Dev] ZEO and setting instance variables in __getstate__

2005-12-29 Thread Tim Peters
[Syver Enstad]
> I have recently upgraded from ZODB 3.2 to 3.5.1. After doing this I
> notice that ZEO throws exceptions on commiting a transaction for certain
> types of Persistent classes.
> ...

I was able to create a small self-contained test case from this description,
and opened a Collector issue containing it:

http://www.zope.org/Collectors/Zope3-dev/526

As it says, I don't know whether it "should work", but offhand don't see why
not.  As is, creating new state inside __getstate__ is confusing the heck
out of ZEO's MVCC cache "for some reason".

___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


[ZODB-Dev] ZEO and setting instance variables in __getstate__

2005-12-29 Thread Syver Enstad
I have recently upgraded from ZODB 3.2 to 3.5.1. After doing this I 
notice that ZEO throws exceptions on commiting a transaction for certain 
types of Persistent classes.


Here is the traceback.

  File "/usr/lib/python2.4/site-packages/transaction/_transaction.py", 
line 389, in commit

self._saveCommitishError() # This raises!
  File "/usr/lib/python2.4/site-packages/transaction/_transaction.py", 
line 387, in commit

self._commitResources()
  File "/usr/lib/python2.4/site-packages/transaction/_transaction.py", 
line 440, in _commitResources

rm.tpc_finish(self)
  File "/usr/lib/python2.4/site-packages/ZODB/Connection.py", line 679, 
in tpc_finish

self._storage.tpc_finish(transaction, callback)
  File "/usr/lib/python2.4/site-packages/ZEO/ClientStorage.py", line 
974, in tpc_finish

self._update_cache(tid)
  File "/usr/lib/python2.4/site-packages/ZEO/ClientStorage.py", line 
999, in _update_cache

self._cache.invalidate(oid, version, tid)
  File "/usr/lib/python2.4/site-packages/ZEO/cache.py", line 367, in 
invalidate

assert tid is not None and cur_tid < tid
AssertionError

I narrowed it down to the problem occuring when I set instance variables 
in __getstate__ (called on commit) on a newly created persistent instance.


This only happens when I am using ZEO (ClientStorage) and not when using 
ZODB (FileStorage).


The reason I have chosen to override __getstate__ is to update the 
Persistent instance with the current username (which I store on the 
transaction when I open the connection) and a timestamp so that the 
instance knows when it was modified last and which user did it.


The new beforeCommitHook seems to be suited for this kind of work, but 
it doesn't give access to the changed objects in the transaction.

___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev