[ZODB-Dev] [ZODB4] - Shouldn't the new object be added to Connection._created ?

Jim Fulton jim@zope.com
Mon, 08 Jul 2002 10:55:31 -0400


Ury Marshak wrote:
> ----- Original Message ----- From: "Jim Fulton" <jim@zope.com>
> 
> 
>>No, the object will be added to the created list in commit_store,
>>where the stack is processed,
>>
> 
> Well, unfortunately this is not what happens to me under ZEO.
> Scenario: a new object is inserted in existing persistent container,
> container gets pickled, persistent_id()  is called, the new object gets
> assigned oid. Transaction fails. The new object still has oid and the works.
 >
 > We retry the transaction (or even access any attribute on the object).
 > The persistent machinery sees the object with _p_state==3, ghost,
 > tries to unghostify it using a [non-existent] oid -- BOOM..

What works? It can't be referenced from the container any more,
because the container was ghostified. The new object isn't in the cache,
so I don't see hos the data could be getting unghostified, or how it could
be ghostified in the first place. How is the transaction failing?


>>Note that, if the transaction is aborted, the reference to the new object
>>will go away and it will disappear, so it doesn't really need to be
>>invalidated. You don't need to keep track of created objects until they
>>have been assigned oids.
>>
> The point is that under ZEO the whole thing seems to take slightly
> different paths (tpc_abort etc)  than when using for example FileStorage
> directly.

That is hard to believe.


> Could it be that ZEO assignes oids to all new objects in the transaction
> and only then sends the whole transaction to the server,

ZEO doesn't assign oids. The connection does that.


 > while the
> local storage is able to detect a conflict early and simply does not get
> to the point of assigning oids..
> (Is it supposed to work under CVS-ZEO at all, or is ZEO scheduled for
> a rewrite or something?)

because ZEO stores asynchronously, conflicts may be detected later, however,
by the time they are detected, the new objects should be
in the created list.

When you get a conflict error, do you call get_transaction().abort()?

Jim



-- 
Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (888) 344-4332            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org