Re: Zeo and two processes changing the zodb - not getting the up to date version of the object
Jim Fulton <[email protected]>
| Newsgroups | gmane.comp.web.zope.zodb |
|---|---|
| Message-ID | <CAPDm-FhrNoZC5awaTp1hR1dbAenmTC-hRQqeQmHTJBWyVoQcCg@mail.gmail.com> |
On Thu, Feb 2, 2017 at 7:01 AM, Jo Gilder <[email protected]> wrote: > Julien, can you explain the difference? I need to read in the properties > of an object and it needs to be the latest values for those properties. The > properties have been updated by another process and then indexing that > object is deferred and handled by a third process. All of these processes > use zeo. > Differences: - readCurrent is optimistic. It doesn't make a server call, but at commit time, it checks to see if an object that was read was subsequently written by a transaction, even if the writing transaction committed after this transaction started. If the data were written then the current transaction aborts with a conflict error. - The approaches Julien and I suggested force ZEO Clients to wait until they've seen at least all updates committed as of the time the transaction began. They specifically address the case of two interdependent transaction executing on ZEO clients. Typically, this is caused by a web application making a request that makes changes on an app server and making a request that depends on those changes on a different app server. Unlike the readCurrent approach, these approaches never cause conflict errors in and of themselves. Jim > > > On Thursday, 2 February 2017 10:58:41 UTC, Julien Muchembled wrote: > >> Le 02/02/17 à 11:53, Jo Gilder a écrit : >> > Thanks, I haven't used monkey patches before. >> > >> > I have now wrapped my readonly code in an explicit transaction and >> using readCurrent seems to be doing the job. More testing needed though. >> >> Maybe I didn't understand your issue but readCurrent has a different >> purpose than all other suggested solutions (which actually all do the same >> thing): >> - ZEO 5 with server-sync true >> - ping the server explictely before transaction.begin() (which may be >> annoying to maintain in your code) >> - use our monkey-patch >> >> Julien >> >> > On Thursday, 2 February 2017 09:50:34 UTC, Julien Muchembled wrote: >> > >> > Le 02/02/17 à 10:26, Jo Gilder a écrit : >> > > Hi, do you have an example of this in use? I can't see where it >> is used in your code base. >> > >> > It's a monkey-patch. Once this module is loaded, we know that we >> have a up-to-date view of the DB when we start a transaction. >> > >> > Here is a place where it's important for us to have such behaviour: >> > https://lab.nexedi.com/nexedi/erp5/blob/f6d96c460323a5b7094f >> eff2fbbf545deb9195db/product/CMFActivity/Activity/SQLBase.py#L497 < >> https://lab.nexedi.com/nexedi/erp5/blob/f6d96c460323a5b7094 >> feff2fbbf545deb9195db/product/CMFActivity/Activity/SQLBase.py#L497> >> > >> > To check this, we also have a unit test at >> > https://lab.nexedi.com/nexedi/erp5/blob/f6d96c460323a5b7094f >> eff2fbbf545deb9195db/product/ERP5/tests/testInvalidationBug.py#L93 < >> https://lab.nexedi.com/nexedi/erp5/blob/f6d96c460323a5b7094 >> feff2fbbf545deb9195db/product/ERP5/tests/testInvalidationBug.py#L93> >> > >> > Julien >> > >> > > On Wednesday, 1 February 2017 18:05:11 UTC, Julien Muchembled >> wrote: >> > > >> > > Le 02/01/17 à 18:37, Jo Gilder a écrit : >> > > > I'm running zeo 4. Is there any way to do this without >> upgrading? We are a week away from a release and upgrading zeo means >> upgrading lots of other packages too. >> > > > >> > > You can use our monkey-patch on >> > > Connection.ping >> > > and >> > > Connection.newTransaction >> > > >> > > https://lab.nexedi.com/nexedi/erp5/blob/master/product/ERP5T >> ype/patches/ZODBConnection.py <https://lab.nexedi.com/nexedi >> /erp5/blob/master/product/ERP5Type/patches/ZODBConnection.py> < >> https://lab.nexedi.com/nexedi/erp5/blob/master/product/ >> ERP5Type/patches/ZODBConnection.py <https://lab.nexedi.com/nexedi >> /erp5/blob/master/product/ERP5Type/patches/ZODBConnection.py>> >> > > >> > > Julien >> > > >> > >> > -- >> > You received this message because you are subscribed to the Google >> Groups "zodb" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> an email to [email protected] <mailto:zodb+uns...@googlegrou >> ps.com>. >> > For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to the Google Groups > "zodb" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Jim Fulton http://jimfulton.info -- You received this message because you are subscribed to the Google Groups "zodb" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.