[Zope-Checkins] CVS: ZODB3/BDBStorage - _helper.c:1.4.32.1 BerkeleyBase.py:1.45.2.1 BDBMinimalStorage.py:1.32.2.2 BDBFullStorage.py:1.75.2.10

Jeremy Hylton jeremy at zope.com
Tue Dec 23 14:06:58 EST 2003


Update of /cvs-repository/ZODB3/BDBStorage
In directory cvs.zope.org:/tmp/cvs-serv26665/BDBStorage

Modified Files:
      Tag: ZODB3-mvcc-2-branch
	_helper.c BerkeleyBase.py BDBMinimalStorage.py 
	BDBFullStorage.py 
Log Message:
Merge the head to the mvcc branch.

This merge should be the final preparation for merging the branch to
the trunk.


=== ZODB3/BDBStorage/_helper.c 1.4 => 1.4.32.1 ===
--- ZODB3/BDBStorage/_helper.c:1.4	Mon Jan 20 17:17:01 2003
+++ ZODB3/BDBStorage/_helper.c	Tue Dec 23 14:06:27 2003
@@ -23,10 +23,17 @@
 #error "Must be using at least Python 2.2"
 #endif
 
+/* Increment an 8-byte unsigned integer (represented as an 8-byte raw string),
+ * by a Python integer.
+ * The arguments are an 8-byte Python string, and a Python int or long.
+ * The result is an 8-byte Python string, representing their sum.
+ * XXX It's unclear what this intends to do if the sum overflows an 8-byte
+ * XXX unsigned integer.  _PyLong_AsByteArray should raise OverflowError then.
+ */
 static PyObject*
 helper_incr(PyObject* self, PyObject* args)
 {
-    PyObject *pylong, *incr, *sum;
+    PyObject *pylong = NULL, *incr, *sum = NULL, *result = NULL;
     char *s, x[8];
     int len, res;
 
@@ -42,21 +49,25 @@
     pylong = _PyLong_FromByteArray(s, len,
                                    0 /* big endian */,
                                    0 /* unsigned */);
-    
+
     if (!pylong)
         return NULL;
 
     sum = PyNumber_Add(pylong, incr);
     if (!sum)
-        return NULL;
+	goto err;
 
     res = _PyLong_AsByteArray((PyLongObject*)sum, x, 8,
                               0 /* big endian */,
                               0 /* unsigned */);
     if (res < 0)
-        return NULL;
+	goto err;
 
-    return PyString_FromStringAndSize(x, 8);
+    result = PyString_FromStringAndSize(x, 8);
+ err:
+    Py_XDECREF(pylong);
+    Py_XDECREF(sum);
+    return result;
 }
 
 


=== ZODB3/BDBStorage/BerkeleyBase.py 1.45 => 1.45.2.1 ===
--- ZODB3/BDBStorage/BerkeleyBase.py:1.45	Thu Oct  2 18:14:00 2003
+++ ZODB3/BDBStorage/BerkeleyBase.py	Tue Dec 23 14:06:27 2003
@@ -32,7 +32,6 @@
 from ZODB.lock_file import lock_file
 from ZODB.BaseStorage import BaseStorage
 from ZODB.referencesf import referencesf
-import ThreadLock
 import zLOG
 
 GBYTES = 1024 * 1024 * 1000
@@ -219,7 +218,7 @@
         self._is_read_only = config.read_only
 
         # Instantiate a pack lock
-        self._packlock = ThreadLock.allocate_lock()
+        self._packlock = threading.RLock()
         self._stop = self._closed = False
         # Initialize a few other things
         self._prefix = prefix


=== ZODB3/BDBStorage/BDBMinimalStorage.py 1.32.2.1 => 1.32.2.2 ===
--- ZODB3/BDBStorage/BDBMinimalStorage.py:1.32.2.1	Tue Dec  2 02:10:29 2003
+++ ZODB3/BDBStorage/BDBMinimalStorage.py	Tue Dec 23 14:06:27 2003
@@ -262,11 +262,13 @@
             # The object exists in the database, but the serial number
             # given in the call is not the same as the last stored serial
             # number.  Raise a ConflictError.
-            data = self.tryToResolveConflict(oid, oserial, serial, data)
-            if data:
+            rdata = self.tryToResolveConflict(oid, oserial, serial, data)
+            if rdata:
                 conflictresolved = True
+                data = rdata
             else:
-                raise POSException.ConflictError(serials=(oserial, serial))
+                raise POSException.ConflictError(
+                    oid=oid, serials=(oserial, serial), data=data)
         # Optimistically write to the serials and pickles table.  Be sure
         # to also update the oids table for this object too.
         newserial = self._tid


=== ZODB3/BDBStorage/BDBFullStorage.py 1.75.2.9 => 1.75.2.10 ===
--- ZODB3/BDBStorage/BDBFullStorage.py:1.75.2.9	Fri Dec 19 17:38:55 2003
+++ ZODB3/BDBStorage/BDBFullStorage.py	Tue Dec 23 14:06:27 2003
@@ -24,7 +24,7 @@
 from ZODB import POSException
 from ZODB.utils import p64, U64
 from ZODB.referencesf import referencesf
-from ZODB.TimeStamp import TimeStamp
+from persistent.TimeStamp import TimeStamp
 from ZODB.ConflictResolution import ConflictResolvingStorage, ResolvedSerial
 
 from BDBStorage import db, ZERO
@@ -477,11 +477,13 @@
             # given in the call is not the same as the last stored serial
             # number.  First, attempt application level conflict
             # resolution, and if that fails, raise a ConflictError.
-            data = self.tryToResolveConflict(oid, tid, serial, data)
-            if data:
+            rdata = self.tryToResolveConflict(oid, tid, serial, data)
+            if rdata:
                 conflictresolved = True
+                data = rdata
             else:
-                raise POSException.ConflictError(serials=(tid, serial))
+                raise POSException.ConflictError(
+                    oid=oid, serials=(tid, serial), data=data)
         # Do we already know about this version?  If not, we need to record
         # the fact that a new version is being created.  version will be the
         # empty string when the transaction is storing on the non-version




More information about the Zope-Checkins mailing list