[CalendarServer-changes] [14941] CalendarServer/trunk/txdav/common/datastore
source_changes at macosforge.org
source_changes at macosforge.org
Thu Jul 2 08:38:53 PDT 2015
Revision: 14941
http://trac.calendarserver.org//changeset/14941
Author: cdaboo at apple.com
Date: 2015-07-02 08:38:53 -0700 (Thu, 02 Jul 2015)
Log Message:
-----------
Make sure bogus files/directories in the file store don't cause problems during migration.
Modified Paths:
--------------
CalendarServer/trunk/txdav/common/datastore/file.py
CalendarServer/trunk/txdav/common/datastore/upgrade/test/test_migrate.py
Modified: CalendarServer/trunk/txdav/common/datastore/file.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/file.py 2015-07-02 15:05:35 UTC (rev 14940)
+++ CalendarServer/trunk/txdav/common/datastore/file.py 2015-07-02 15:38:53 UTC (rev 14941)
@@ -276,7 +276,8 @@
continue
txn = self.newTransaction("enumerate home %r" % (uid,))
home = txn.homeWithUID(storeType, uid, False)
- yield (txn, home)
+ if home is not None:
+ yield (txn, home)
def _eachCalendarHome(self):
Modified: CalendarServer/trunk/txdav/common/datastore/upgrade/test/test_migrate.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/upgrade/test/test_migrate.py 2015-07-02 15:05:35 UTC (rev 14940)
+++ CalendarServer/trunk/txdav/common/datastore/upgrade/test/test_migrate.py 2015-07-02 15:38:53 UTC (rev 14941)
@@ -295,6 +295,15 @@
L{UpgradeToDatabaseService.startService} will do the upgrade, then
start its dependent service by adding it to its service hierarchy.
"""
+
+ # Create a fake directory in the same place as a home, but with a non-existent uid
+ fake_dir = self.filesPath.child("calendars").child("__uids__").child("ho").child("me").child("foobar")
+ fake_dir.makedirs()
+
+ # Create a fake file in the same place as a home,with a name that matches the hash uid prefix
+ fake_file = self.filesPath.child("calendars").child("__uids__").child("ho").child("me").child("home_file")
+ fake_file.setContent("")
+
yield self.upgrader.stepWithResult(None)
txn = self.sqlStore.newTransaction()
self.addCleanup(txn.commit)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150702/334bf146/attachment.html>
More information about the calendarserver-changes
mailing list