[CalendarServer-changes] [8529] CalendarServer/branches/users/glyph/skip-lonely-vtimezones
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jan 13 14:03:05 PST 2012
Revision: 8529
http://trac.macosforge.org/projects/calendarserver/changeset/8529
Author: glyph at apple.com
Date: 2012-01-13 14:03:05 -0800 (Fri, 13 Jan 2012)
Log Message:
-----------
abort transactions when migration fails catastrophically, to allow test suite to continue
Modified Paths:
--------------
CalendarServer/branches/users/glyph/skip-lonely-vtimezones/txdav/common/datastore/upgrade/migrate.py
Property Changed:
----------------
CalendarServer/branches/users/glyph/skip-lonely-vtimezones/
Modified: CalendarServer/branches/users/glyph/skip-lonely-vtimezones/txdav/common/datastore/upgrade/migrate.py
===================================================================
--- CalendarServer/branches/users/glyph/skip-lonely-vtimezones/txdav/common/datastore/upgrade/migrate.py 2012-01-13 22:03:02 UTC (rev 8528)
+++ CalendarServer/branches/users/glyph/skip-lonely-vtimezones/txdav/common/datastore/upgrade/migrate.py 2012-01-13 22:03:05 UTC (rev 8529)
@@ -23,6 +23,7 @@
import errno
import xattr
+from twisted.python.failure import Failure
from twext.python.log import LoggingMixIn
from twisted.python.runtime import platform
@@ -304,17 +305,25 @@
yield sqlTxn.abort()
yield fileTxn.commit()
returnValue(None)
- sqlHome = yield homeGetter(uid, create=True)
- yield migrateFunc(fileHome, sqlHome)
- yield fileTxn.commit()
- yield sqlTxn.commit()
- # Remove file home after migration. FIXME: instead, this should be a
- # public remove...HomeWithUID() API for de-provisioning. (If we had
- # this, this would simply be a store-to-store migrator rather than a
- # filesystem-to-database upgrade.)
- fileHome._path.remove()
+ try:
+ sqlHome = yield homeGetter(uid, create=True)
+ yield migrateFunc(fileHome, sqlHome)
+ except:
+ f = Failure()
+ yield fileTxn.abort()
+ yield sqlTxn.abort()
+ f.raiseException()
+ else:
+ yield fileTxn.commit()
+ yield sqlTxn.commit()
+ # Remove file home after migration. FIXME: instead, this should be a
+ # public remove...HomeWithUID() API for de-provisioning. (If we had
+ # this, this would simply be a store-to-store migrator rather than a
+ # filesystem-to-database upgrade.)
+ fileHome._path.remove()
+
@inlineCallbacks
def doMigration(self):
"""
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120113/acfd7044/attachment-0001.html>
More information about the calendarserver-changes
mailing list