[CalendarServer-changes] [8820] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Tue Mar 6 09:47:19 PST 2012
Revision: 8820
http://trac.macosforge.org/projects/calendarserver/changeset/8820
Author: sagen at apple.com
Date: 2012-03-06 09:47:18 -0800 (Tue, 06 Mar 2012)
Log Message:
-----------
By default, calendarserver_upgrade will no longer process inbox items (use --postprocess to process inbox items); instead leave that to the real server. Also when processing inbox itemsskip attendee refreshes.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tap/caldav.py
CalendarServer/trunk/calendarserver/tools/cmdline.py
CalendarServer/trunk/calendarserver/tools/upgrade.py
CalendarServer/trunk/twistedcaldav/scheduling/processing.py
CalendarServer/trunk/twistedcaldav/upgrade.py
Modified: CalendarServer/trunk/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/caldav.py 2012-03-06 15:15:52 UTC (rev 8819)
+++ CalendarServer/trunk/calendarserver/tap/caldav.py 2012-03-06 17:47:18 UTC (rev 8820)
@@ -919,13 +919,17 @@
else:
parallel = 0
spawner = ConfiguredChildSpawner(self, dispenser, config)
+ if getattr(self, "doPostImport", True):
+ postImport = PostDBImportService(config, store, mainService)
+ else:
+ postImport = mainService
upgradeSvc = UpgradeFileSystemFormatService(
config, spawner, parallel,
UpgradeDatabaseSchemaService.wrapService(
UpgradeDatabaseDataService.wrapService(
UpgradeToDatabaseService.wrapService(
CachingFilePath(config.DocumentRoot),
- PostDBImportService(config, store, mainService),
+ postImport,
store, uid=overrideUID, gid=overrideGID,
spawner=spawner, merge=config.MergeUpgrades,
parallel=parallel
Modified: CalendarServer/trunk/calendarserver/tools/cmdline.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/cmdline.py 2012-03-06 15:15:52 UTC (rev 8819)
+++ CalendarServer/trunk/calendarserver/tools/cmdline.py 2012-03-06 17:47:18 UTC (rev 8820)
@@ -26,7 +26,7 @@
# TODO: direct unit tests for this function.
-def utilityMain(configFileName, serviceClass, reactor=None):
+def utilityMain(configFileName, serviceClass, reactor=None, serviceMaker=CalDAVServiceMaker):
"""
Shared main-point for utilities.
@@ -67,7 +67,7 @@
autoDisableMemcached(config)
- maker = CalDAVServiceMaker()
+ maker = serviceMaker()
options = CalDAVOptions
service = maker.makeService(options)
Modified: CalendarServer/trunk/calendarserver/tools/upgrade.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/upgrade.py 2012-03-06 15:15:52 UTC (rev 8819)
+++ CalendarServer/trunk/calendarserver/tools/upgrade.py 2012-03-06 17:47:18 UTC (rev 8820)
@@ -34,6 +34,7 @@
from twext.python.log import setLogLevelForNamespace
+from calendarserver.tap.caldav import CalDAVServiceMaker
def usage(e=None):
if e:
@@ -72,6 +73,8 @@
optParameters = [['config', 'f', DEFAULT_CONFIG_FILE,
"Specify caldavd.plist configuration path."]]
+ optFlags = [['postprocess', 'p', "Perform post-database-import processing."]]
+
def __init__(self):
super(UpgradeOptions, self).__init__()
self.upgradeers = []
@@ -180,7 +183,11 @@
setLogLevelForNamespace(None, "debug")
log.addObserver(onlyUpgradeEvents)
- utilityMain(options["config"], makeService, reactor)
+ def customServiceMaker():
+ customService = CalDAVServiceMaker()
+ customService.doPostImport = options["postprocess"]
+ return customService
+ utilityMain(options["config"], makeService, reactor, customServiceMaker)
def logDateString():
logtime = time.localtime()
Modified: CalendarServer/trunk/twistedcaldav/scheduling/processing.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/processing.py 2012-03-06 15:15:52 UTC (rev 8819)
+++ CalendarServer/trunk/twistedcaldav/scheduling/processing.py 2012-03-06 17:47:18 UTC (rev 8820)
@@ -203,8 +203,10 @@
),
)
- # Only update other attendees when the partstat was changed by the reply
- if partstatChanged:
+ # Only update other attendees when the partstat was changed by the reply,
+ # and only if the request does not indicate we should skip attendee refresh
+ # (e.g. inbox item processing during migration from non-implicit server)
+ if partstatChanged and not getattr(self.request, "NoAttendeeRefresh", False):
yield self.queueAttendeeUpdate((attendeeReplying,))
result = (True, False, True, changes,)
Modified: CalendarServer/trunk/twistedcaldav/upgrade.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/upgrade.py 2012-03-06 15:15:52 UTC (rev 8819)
+++ CalendarServer/trunk/twistedcaldav/upgrade.py 2012-03-06 17:47:18 UTC (rev 8820)
@@ -1089,7 +1089,7 @@
for ctr, inboxItem in enumerate(itemsToProcess):
log.info("Processing %d/%d inbox item: %s" % (ctr+1, totalItems, inboxItem,))
ignore, uuid, ignore, fileName = inboxItem.rsplit("/", 3)
-
+
if uuid in ignoreUUIDs:
log.debug("Ignored inbox item - uuid ignored: %s" % (inboxItem,))
inboxItems.remove(inboxItem)
@@ -1110,6 +1110,7 @@
continue
request = FakeRequest(root, "PUT", None)
+ request.NoAttendeeRefresh = True # tell scheduling to skip refresh
request.checkedSACL = True
request.authnUser = request.authzUser = davxml.Principal(
davxml.HRef.fromString("/principals/__uids__/%s/" % (uuid,))
@@ -1125,17 +1126,17 @@
inboxItems.remove(inboxItem)
ignoreUUIDs.add(uuid)
continue
-
+
inbox = yield calendarHome.getChild("inbox")
if inbox is not None and inbox.exists():
-
+
inboxItemResource = yield inbox.getChild(fileName)
if inboxItemResource is not None and inboxItemResource.exists():
-
+
uri = "/calendars/__uids__/%s/inbox/%s" % (uuid, fileName)
request.path = uri
request._rememberResource(inboxItemResource, uri)
-
+
try:
txnCommitted = yield self.processInboxItem(
root,
@@ -1155,9 +1156,9 @@
else:
log.debug("Ignored inbox item - no inbox: %s" % (inboxItem,))
-
+
inboxItems.remove(inboxItem)
-
+
finally:
if not txnCommitted and hasattr(request, "_newStoreTransaction"):
request._newStoreTransaction.abort()
@@ -1166,10 +1167,10 @@
# we are not logging properly.
except Exception, e:
log.error("Exception during inbox item processing: %s" % (e,))
-
+
except:
log.error("Unknown exception during inbox item processing.")
-
+
finally:
if inboxItems:
# Rewrite the inbox items file in case we exit before we're
@@ -1209,6 +1210,7 @@
if calendar.mainType() is not None:
try:
method = calendar.propertyValue("METHOD")
+ log.info("Inbox item method is %s" % (method,))
except ValueError:
returnValue(None)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120306/8d75a16a/attachment.html>
More information about the calendarserver-changes
mailing list