[CalendarServer-changes] [12667] CalendarServer/branches/release/CalendarServer-5.2-dev/txdav
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 12 11:15:45 PDT 2014
Revision: 12667
http://trac.calendarserver.org//changeset/12667
Author: cdaboo at apple.com
Date: 2014-02-11 19:25:08 -0800 (Tue, 11 Feb 2014)
Log Message:
-----------
Make sure a missing home child revision does not cause an exception.
Modified Paths:
--------------
CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/test/test_sql.py
CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/common/datastore/sql.py
Modified: CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/test/test_sql.py 2014-02-12 03:22:49 UTC (rev 12666)
+++ CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/caldav/datastore/test/test_sql.py 2014-02-12 03:25:08 UTC (rev 12667)
@@ -1955,7 +1955,40 @@
self.assertNotEqual(caldata4, None)
+ @inlineCallbacks
+ def test_calendarMissingRevision(self):
+ """
+ Test that two concurrent attempts to add resources in two separate
+ calendar homes does not deadlock on the revision table update.
+ """
+ # Get details
+ txn = self.transactionUnderTest()
+ home = yield txn.homeWithUID(ECALENDARTYPE, "user01", create=True)
+ self.assertNotEqual(home, None)
+ calendar = yield home.childWithName("calendar")
+ self.assertNotEqual(calendar, None)
+
+ rev = calendar._revisionsSchema
+ yield Delete(
+ From=rev,
+ Where=(rev.HOME_RESOURCE_ID == Parameter("homeID")).And(
+ rev.COLLECTION_NAME == Parameter("collectionName"))
+ ).on(self.transactionUnderTest(), homeID=home.id(), collectionName="calendar")
+
+ yield self.commit()
+
+ home = yield self.homeUnderTest(name="user01")
+ children = yield home.loadChildren()
+ self.assertEqual(len(children), 3)
+ yield self.commit()
+
+ calendar = yield self.calendarUnderTest(home="user01", name="calendar")
+ token = yield calendar.syncToken()
+ self.assertTrue(token is not None)
+
+
+
class SchedulingTests(CommonCommonTests, unittest.TestCase):
"""
CalendarObject splitting tests
Modified: CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/common/datastore/sql.py 2014-02-12 03:22:49 UTC (rev 12666)
+++ CalendarServer/branches/release/CalendarServer-5.2-dev/txdav/common/datastore/sql.py 2014-02-12 03:25:08 UTC (rev 12667)
@@ -3548,7 +3548,7 @@
setattr(child, attr, value)
for attr, value in zip(cls.metadataAttributes(), metadata):
setattr(child, attr, value)
- child._syncTokenRevision = revisions[resourceID]
+ child._syncTokenRevision = revisions.get(resourceID, 0)
propstore = propertyStores.get(resourceID, None)
# We have to re-adjust the property store object to account for possible shared
# collections as previously we loaded them all as if they were owned
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/2397470b/attachment.html>
More information about the calendarserver-changes
mailing list