[CalendarServer-changes] [8333] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Fri Nov 18 13:12:21 PST 2011
Revision: 8333
http://trac.macosforge.org/projects/calendarserver/changeset/8333
Author: sagen at apple.com
Date: 2011-11-18 13:12:18 -0800 (Fri, 18 Nov 2011)
Log Message:
-----------
Moves the "migrating" argument from newTransaction( ) to a setMigration( ) state on the store itself. newTransaction( ) now honors that state.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/stdconfig.py
CalendarServer/trunk/twistedcaldav/upgrade.py
CalendarServer/trunk/txdav/common/datastore/file.py
CalendarServer/trunk/txdav/common/datastore/sql.py
CalendarServer/trunk/txdav/common/datastore/util.py
CalendarServer/trunk/txdav/idav.py
Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py 2011-11-18 19:05:48 UTC (rev 8332)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py 2011-11-18 21:12:18 UTC (rev 8333)
@@ -644,7 +644,7 @@
"ProviderPort" : 2195,
"FeedbackHost" : "feedback.push.apple.com",
"FeedbackPort" : 2196,
- "FeedbackUpdateSeconds" : 300, # 5 minutes
+ "FeedbackUpdateSeconds" : 28800, # 8 hours
"Environment" : "PRODUCTION",
"CalDAV" : {
"CertificatePath" : "",
Modified: CalendarServer/trunk/twistedcaldav/upgrade.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/upgrade.py 2011-11-18 19:05:48 UTC (rev 8332)
+++ CalendarServer/trunk/twistedcaldav/upgrade.py 2011-11-18 21:12:18 UTC (rev 8333)
@@ -989,7 +989,9 @@
os.chown(dbPath, uid, gid)
# Process old inbox items
+ self.store.setMigrating(True)
yield self.processInboxItems()
+ self.store.setMigrating(False)
@inlineCallbacks
@@ -1091,7 +1093,6 @@
log.debug("Processing inbox item %s" % (inboxItem,))
txn = request._newStoreTransaction
- txn._notifierFactory = None # Do not send push notifications
ownerPrincipal = principal
cua = "urn:uuid:%s" % (uuid,)
Modified: CalendarServer/trunk/txdav/common/datastore/file.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/file.py 2011-11-18 19:05:48 UTC (rev 8332)
+++ CalendarServer/trunk/txdav/common/datastore/file.py 2011-11-18 21:12:18 UTC (rev 8333)
@@ -111,9 +111,10 @@
self._transactionClass = CommonStoreTransaction
self._propertyStoreClass = propertyStoreClass
self.quota = quota
+ self._migrating = False
- def newTransaction(self, name='no name', migrating=False):
+ def newTransaction(self, name='no name'):
"""
Create a new transaction.
@@ -125,10 +126,17 @@
self.enableCalendars,
self.enableAddressBooks,
self._notifierFactory,
- migrating,
+ self._migrating,
)
+ def setMigrating(self, state):
+ """
+ Set the "migrating" state
+ """
+ self._migrating = 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-11-18 19:05:48 UTC (rev 8332)
+++ CalendarServer/trunk/txdav/common/datastore/sql.py 2011-11-18 21:12:18 UTC (rev 8333)
@@ -142,6 +142,7 @@
self.enableAddressBooks = enableAddressBooks
self.label = label
self.quota = quota
+ self._migrating = False
def eachCalendarHome(self):
@@ -159,7 +160,7 @@
- def newTransaction(self, label="unlabeled", migrating=False):
+ def newTransaction(self, label="unlabeled"):
"""
@see L{IDataStore.newTransaction}
"""
@@ -168,11 +169,18 @@
self.sqlTxnFactory(),
self.enableCalendars,
self.enableAddressBooks,
- None if migrating else self.notifierFactory,
+ None if self._migrating else self.notifierFactory,
label,
- migrating,
+ self._migrating,
)
+ def setMigrating(self, state):
+ """
+ Set the "migrating" state
+ """
+ self._migrating = state
+
+
class TransactionStatsCollector(object):
def __init__(self):
Modified: CalendarServer/trunk/txdav/common/datastore/util.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/util.py 2011-11-18 19:05:48 UTC (rev 8332)
+++ CalendarServer/trunk/txdav/common/datastore/util.py 2011-11-18 21:12:18 UTC (rev 8333)
@@ -131,6 +131,8 @@
@return: a Deferred which fires when the migration is complete.
"""
+ self.sqlStore.setMigrating(True)
+
self.log_warn("Beginning filesystem -> database upgrade.")
for homeType, migrateFunc, eachFunc, destFunc, topPathName in [
("calendar", migrateCalendarHome,
@@ -145,7 +147,7 @@
for fileTxn, fileHome in eachFunc():
uid = fileHome.uid()
self.log_warn("Migrating %s UID %r" % (homeType, uid))
- sqlTxn = self.sqlStore.newTransaction(migrating=True)
+ sqlTxn = self.sqlStore.newTransaction()
homeGetter = destFunc(sqlTxn)
if (yield homeGetter(uid, create=False)) is not None:
self.log_warn(
@@ -181,6 +183,8 @@
for fp in sqlAttachmentsPath.walk():
os.chown(fp.path, uid, gid)
+ self.sqlStore.setMigrating(False)
+
self.log_warn(
"Filesystem upgrade complete, launching database service."
)
Modified: CalendarServer/trunk/txdav/idav.py
===================================================================
--- CalendarServer/trunk/txdav/idav.py 2011-11-18 19:05:48 UTC (rev 8332)
+++ CalendarServer/trunk/txdav/idav.py 2011-11-18 21:12:18 UTC (rev 8333)
@@ -116,7 +116,16 @@
@rtype: L{ITransaction}
"""
+ def setMigrating(state):
+ """
+ Set the "migrating" state to either True or False. This state is
+ used to supress push notifications and etag changes.
+ @param state: the boolean value to set the migrating state to
+ @type state: C{boolean}
+ """
+
+
class IDataStoreObject(Interface):
"""
An L{IDataStoreObject} are the objects stored in an L{IDataStore}.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20111118/88526048/attachment.html>
More information about the calendarserver-changes
mailing list