[Neo-report] r1877 vincent - /trunk/neo/client/app.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Mar 1 14:34:11 CET 2010


Author: vincent
Date: Mon Mar  1 14:34:10 2010
New Revision: 1877

Log:
Decide to allow undoing transaction on object data rather than TID.

This fixes the inability to undo T-1 after undoing T.
For reference, this is what is done in RelStorage. It is not as restrictive
as FileStorage, but implementing the same support would/will take more
time.

Modified:
    trunk/neo/client/app.py

Modified: trunk/neo/client/app.py
==============================================================================
--- trunk/neo/client/app.py [iso-8859-1] (original)
+++ trunk/neo/client/app.py [iso-8859-1] Mon Mar  1 14:34:10 2010
@@ -805,21 +805,22 @@
         oid_list = self.local_var.txn_info['oids']
         # Second get object data from storage node using loadBefore
         data_dict = {}
+        # XXX: this way causes each object to be loaded 3 times from storage,
+        # this work should rather be offloaded to it.
         for oid in oid_list:
-            try:
-                result = self.loadBefore(oid, transaction_id)
+            current_data = self.load(oid)[0]
+            after_data = self.loadSerial(oid, transaction_id)
+            if current_data != after_data:
+                raise UndoError("non-undoable transaction", oid)
+            try:
+                data = self.loadBefore(oid, transaction_id)[0]
             except NEOStorageNotFoundError:
                 if oid == '\x00' * 8:
                     # Refuse undoing root object creation.
                     raise UndoError("no previous record", oid)
                 else:
                     # Undo object creation
-                    result = ('', None, transaction_id)
-            data, start, end = result
-            # end must be TID we are going to undone otherwise it means
-            # a later transaction modify the object
-            if end != transaction_id:
-                raise UndoError("non-undoable transaction", oid)
+                    data = ''
             data_dict[oid] = data
 
         # Third do transaction with old data





More information about the Neo-report mailing list