[CalendarServer-changes] [8434] CalendarServer/trunk/txdav/common/datastore

source_changes at macosforge.org source_changes at macosforge.org
Tue Dec 13 12:26:14 PST 2011


Revision: 8434
          http://trac.macosforge.org/projects/calendarserver/changeset/8434
Author:   cdaboo at apple.com
Date:     2011-12-13 12:26:11 -0800 (Tue, 13 Dec 2011)
Log Message:
-----------
Make sure notifications are off for schema/data upgrades.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/common/datastore/file.py
    CalendarServer/trunk/txdav/common/datastore/sql.py
    CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrade.py

Modified: CalendarServer/trunk/txdav/common/datastore/file.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/file.py	2011-12-13 19:48:41 UTC (rev 8433)
+++ CalendarServer/trunk/txdav/common/datastore/file.py	2011-12-13 20:26:11 UTC (rev 8434)
@@ -112,6 +112,7 @@
         self._propertyStoreClass = propertyStoreClass
         self.quota = quota
         self._migrating = False
+        self._enableNotifications = True
 
 
     def newTransaction(self, name='no name'):
@@ -125,7 +126,7 @@
             name,
             self.enableCalendars,
             self.enableAddressBooks,
-            self._notifierFactory,
+            self._notifierFactory if self._enableNotifications else None,
             self._migrating,
         )
 
@@ -135,8 +136,15 @@
         Set the "migrating" state
         """
         self._migrating = state
+        self._enableNotifications = not state
 
+    def setUpgrading(self, state):
+        """
+        Set the "upgrading" state
+        """
+        self._enableNotifications = not state
 
+
     def _homesOfType(self, storeType):
         """
         Common implementation of L{ICalendarStore.eachCalendarHome} and

Modified: CalendarServer/trunk/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql.py	2011-12-13 19:48:41 UTC (rev 8433)
+++ CalendarServer/trunk/txdav/common/datastore/sql.py	2011-12-13 20:26:11 UTC (rev 8434)
@@ -143,6 +143,7 @@
         self.label = label
         self.quota = quota
         self._migrating = False
+        self._enableNotifications = True
 
 
     def eachCalendarHome(self):
@@ -169,7 +170,7 @@
             self.sqlTxnFactory(),
             self.enableCalendars,
             self.enableAddressBooks,
-            None if self._migrating else self.notifierFactory,
+            self.notifierFactory if self._enableNotifications else None,
             label,
             self._migrating,
         )
@@ -179,8 +180,15 @@
         Set the "migrating" state
         """
         self._migrating = state
+        self._enableNotifications = not state
 
+    def setUpgrading(self, state):
+        """
+        Set the "upgrading" state
+        """
+        self._enableNotifications = not state
 
+
 class TransactionStatsCollector(object):
     
     def __init__(self):

Modified: CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrade.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrade.py	2011-12-13 19:48:41 UTC (rev 8433)
+++ CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrade.py	2011-12-13 20:26:11 UTC (rev 8434)
@@ -114,7 +114,9 @@
             self.log_error(msg)
             raise RuntimeError(msg)
         else:
+            self.sqlStore.setUpgrading(True)
             yield self.upgradeVersion(actual_version, required_version, dialect)
+            self.sqlStore.setUpgrading(False)
             
         self.log_warn("Database %s check complete." % (self.versionDescriptor,))
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20111213/0b82060c/attachment.html>


More information about the calendarserver-changes mailing list