[CalendarServer-changes] [8729] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Sat Feb 18 13:45:14 PST 2012


Revision: 8729
          http://trac.macosforge.org/projects/calendarserver/changeset/8729
Author:   cdaboo at apple.com
Date:     2012-02-18 13:45:13 -0800 (Sat, 18 Feb 2012)
Log Message:
-----------
Optimize home sync-token query and turn sync on home back on.

Modified Paths:
--------------
    CalendarServer/trunk/contrib/tools/protocolanalysis.py
    CalendarServer/trunk/twistedcaldav/stdconfig.py
    CalendarServer/trunk/txdav/common/datastore/sql.py

Modified: CalendarServer/trunk/contrib/tools/protocolanalysis.py
===================================================================
--- CalendarServer/trunk/contrib/tools/protocolanalysis.py	2012-02-18 21:44:02 UTC (rev 8728)
+++ CalendarServer/trunk/contrib/tools/protocolanalysis.py	2012-02-18 21:45:13 UTC (rev 8729)
@@ -248,7 +248,9 @@
         self.hourlyTotals = [[0, 0, 0, collections.defaultdict(int), 0.0,] for _ignore in xrange(self.timeBucketCount)]
         
         self.clientTotals = collections.defaultdict(lambda:[0, set()])
+        self.clientIDMap = {}
         self.clientByMethodCount = collections.defaultdict(lambda:collections.defaultdict(int))
+        self.clientIDByMethodCount = {}
         self.clientByMethodTotalTime = collections.defaultdict(lambda:collections.defaultdict(float))
         self.clientByMethodAveragedTime = collections.defaultdict(lambda:collections.defaultdict(float))
         self.statusByMethodCount = collections.defaultdict(lambda:collections.defaultdict(int))
@@ -495,7 +497,14 @@
             for method, totaltime in data.iteritems():
                 count = self.clientByMethodCount[client][method]
                 self.clientByMethodAveragedTime[client][method] = totaltime/count if count else 0
-        
+
+        self.clientIDMap = {}
+        for ctr, client in enumerate(sorted(self.clientByMethodCount.keys())):
+            self.clientIDMap[client] = "ID-%02d" % (ctr+1,)
+        self.clientIDByMethodCount = {}
+        for client, data in self.clientByMethodCount.iteritems():
+            self.clientIDByMethodCount[self.clientIDMap[client]] = data
+
         return ctr
 
     def parseLine(self, line):
@@ -936,7 +945,7 @@
         self.printInstanceCount(doTabs)
 
         print "Protocol Analysis by Client"
-        self.printXXXMethodDetails(self.clientByMethodCount, doTabs)
+        self.printXXXMethodDetails(self.clientIDByMethodCount, doTabs)
         
         if len(self.requestSizeByBucket):
             print "Request size distribution"

Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py	2012-02-18 21:44:02 UTC (rev 8728)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py	2012-02-18 21:45:13 UTC (rev 8729)
@@ -492,7 +492,7 @@
     #
     "EnableAddMember"             : True,  # POST ;add-member extension
     "EnableSyncReport"            : True,  # REPORT collection-sync
-    "EnableSyncReportHome"        : False, # REPORT collection-sync on home collections
+    "EnableSyncReportHome"        : True,  # REPORT collection-sync on home collections
     "EnableWellKnown"             : True,  # /.well-known resource
     "EnableCalendarQueryExtended" : True,  # Extended calendar-query REPORT
 

Modified: CalendarServer/trunk/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql.py	2012-02-18 21:44:02 UTC (rev 8728)
+++ CalendarServer/trunk/txdav/common/datastore/sql.py	2012-02-18 21:45:13 UTC (rev 8729)
@@ -62,7 +62,7 @@
 from twext.python.clsprop import classproperty
 from twext.enterprise.ienterprise import AlreadyFinishedError
 from twext.enterprise.dal.parseschema import significant
-from twext.enterprise.dal.syntax import Delete, utcNowSQL
+from twext.enterprise.dal.syntax import Delete, utcNowSQL, Union
 from twext.enterprise.dal.syntax import Insert
 from twext.enterprise.dal.syntax import Len
 from twext.enterprise.dal.syntax import Max
@@ -1033,12 +1033,27 @@
         bind = cls._bindSchema
         return Select(
             [Max(rev.REVISION)],
-            From=rev, Where=(
-                rev.RESOURCE_ID.In(Select(
-                    [bind.RESOURCE_ID], From=bind,
-                    Where=bind.HOME_RESOURCE_ID == Parameter("resourceID")))
-            ).Or((rev.HOME_RESOURCE_ID == Parameter("resourceID")).And(
-                rev.RESOURCE_ID == None))
+            From=Select(
+                [rev.REVISION],
+                From=rev,
+                Where=(
+                    rev.RESOURCE_ID.In(
+                        Select(
+                            [bind.RESOURCE_ID],
+                            From=bind,
+                            Where=bind.HOME_RESOURCE_ID == Parameter("resourceID"),
+                        )
+                    )
+                ),
+                SetExpression=Union(
+                    Select(
+                        [rev.REVISION],
+                        From=rev,
+                        Where=(rev.HOME_RESOURCE_ID == Parameter("resourceID")).And(rev.RESOURCE_ID == None),
+                    ),
+                    optype=Union.OPTYPE_ALL,
+                )
+            ),
         )
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120218/c3e24316/attachment-0001.html>


More information about the calendarserver-changes mailing list