[Erp5-report] r39710 seb - in /erp5/trunk/products: CMFActivity/Activity/ ERP5Type/ ERP5Typ...
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Oct 29 19:15:35 CEST 2010
Author: seb
Date: Fri Oct 29 19:15:34 2010
New Revision: 39710
URL: http://svn.erp5.org?rev=39710&view=rev
Log:
Commit fix done by Julien and Leonardo
Activities could read from the ZODB an state older than the one
that caused the activity to be created, if:
1.Zope client node (node A) processing an activity message is different
than the one that created the activity (node B),
2.The object cache for node A contains objects concerning the activity
message (or its container)
3.The node A hasn't yet received the invalidation message from the ZEO
server, for instance, if its still on the network layer (kernel buffers,
routers in between, etc...)
The simplest fix for this issue is sending a synchronous message to the
ZEO server before the beginning of a transaction. This message will act
like a “network barrier”, making sure that any invalidation messages
sent before that point from the ZEO server are already received, and the
transaction can begin with an “updated enough” state.
Additional note from Yoshinori : This patch must be proposed to zope
developpers as soon as possible and see with them if this way is the
best.
Added:
erp5/trunk/products/ERP5Type/patches/ZODBConnection.py
Modified:
erp5/trunk/products/CMFActivity/Activity/SQLBase.py
erp5/trunk/products/ERP5Type/ZopePatch.py
Modified: erp5/trunk/products/CMFActivity/Activity/SQLBase.py
URL: http://svn.erp5.org/erp5/trunk/products/CMFActivity/Activity/SQLBase.py?rev=39710&r1=39709&r2=39710&view=diff
==============================================================================
--- erp5/trunk/products/CMFActivity/Activity/SQLBase.py [utf8] (original)
+++ erp5/trunk/products/CMFActivity/Activity/SQLBase.py [utf8] Fri Oct 29 19:15:34 2010
@@ -322,6 +322,7 @@ class SQLBase:
# So all connectors must be committed now that we have selected
# everything needed from MySQL to get a fresh view of ZODB objects.
transaction.commit()
+ transaction.begin()
tv = getTransactionalVariable()
tv['activity_runtime_environment'] = activity_runtime_environment
# Try to invoke
Modified: erp5/trunk/products/ERP5Type/ZopePatch.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/ZopePatch.py?rev=39710&r1=39709&r2=39710&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/ZopePatch.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/ZopePatch.py [utf8] Fri Oct 29 19:15:34 2010
@@ -62,6 +62,7 @@ from Products.ERP5Type.patches import ma
from Products.ERP5Type.patches import ClientStorage
from Products.ERP5Type.patches import DemoStorage
from Products.ERP5Type.patches import unicodeconflictresolver
+from Products.ERP5Type.patches import ZODBConnection
# BACK: Forward Compatibility with Zope 2.12 or CMF 2.2. Remove when we've
# dropped support for older versions.
from Products.ERP5Type.patches import TransactionAddBeforeCommitHook
Added: erp5/trunk/products/ERP5Type/patches/ZODBConnection.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/ZODBConnection.py?rev=39710&view=auto
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/ZODBConnection.py (added)
+++ erp5/trunk/products/ERP5Type/patches/ZODBConnection.py [utf8] Fri Oct 29 19:15:34 2010
@@ -0,0 +1,40 @@
+##############################################################################
+#
+# Copyright (c) 2010 Nexedi SA and Contributors.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE
+#
+##############################################################################
+
+# override ZODB.Connection.newTransaction() to do a synchronous call before
+# flushing all invalidations, this will serve as a "network barrier" that
+# will force Connection to wait for all invalidations sent from other parallel
+# transactions so that, for instance, activity processing can see a recent
+# enough state of the ZODB.
+
+from ZODB.Connection import Connection
+
+if 1: # keep indentation. Also good for quick disabling.
+
+ def ping(self):
+ # Use a synchronous call to make sure we have received all invalidation
+ # methods that could be stuck in the wire so MVCC behaves correctly.
+ # XXX Use a proper ping method exported by ClientStorage instead of
+ # this hack
+ ping = getattr(getattr(self._storage, '_server', None),
+ 'getAuthProtocol',
+ lambda: None)
+ ping()
+
+ def newTransaction(self, *ignored):
+ self.ping()
+ self._storage_sync()
+
+ Connection.ping = ping
+ Connection.newTransaction = newTransaction
+
More information about the Erp5-report
mailing list