[CalendarServer-changes] [5713] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed Jun 9 15:17:49 PDT 2010


Revision: 5713
          http://trac.macosforge.org/projects/calendarserver/changeset/5713
Author:   sagen at apple.com
Date:     2010-06-09 15:17:47 -0700 (Wed, 09 Jun 2010)
Log Message:
-----------
Set journal_mode to PERSIST when opening sqlite dbs, in order to cut down on the unlink( ) calls.

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/test/test_purge.py
    CalendarServer/trunk/twistedcaldav/sql.py

Modified: CalendarServer/trunk/calendarserver/tools/test/test_purge.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/test/test_purge.py	2010-06-09 22:10:53 UTC (rev 5712)
+++ CalendarServer/trunk/calendarserver/tools/test/test_purge.py	2010-06-09 22:17:47 UTC (rev 5713)
@@ -99,6 +99,9 @@
                                 ".db.sqlite": {
                                     "@contents" : None, # ignore contents
                                 },
+                                ".db.sqlite-journal": {
+                                    "@contents" : None, # ignore contents
+                                },
                                 "endless.ics": {
                                     "@contents" : ENDLESS_ICS,
                                 },
@@ -528,6 +531,9 @@
                                 ".db.sqlite": {
                                     "@contents" : None, # ignore contents
                                 },
+                                ".db.sqlite-journal": {
+                                    "@contents" : None, # ignore contents
+                                },
                                 "noninvite.ics": {
                                     "@contents" : NON_INVITE_ICS,
                                 },
@@ -542,6 +548,9 @@
                                 ".db.sqlite": {
                                     "@contents" : None, # ignore contents
                                 },
+                                ".db.sqlite-journal": {
+                                    "@contents" : None, # ignore contents
+                                },
                                 "*.ics/UID:7ED97931-9A19-4596-9D4D-52B36D6AB803": {
                                     "@contents" : (
                                         "METHOD:CANCEL",
@@ -558,6 +567,9 @@
                                 ".db.sqlite": {
                                     "@contents" : None, # ignore contents
                                 },
+                                ".db.sqlite-journal": {
+                                    "@contents" : None, # ignore contents
+                                },
                                 "organizer.ics": {
                                     "@contents" : (
                                         "STATUS:CANCELLED",
@@ -657,6 +669,9 @@
                                 ".db.sqlite": {
                                     "@contents" : None, # ignore contents
                                 },
+                                ".db.sqlite-journal": {
+                                    "@contents" : None, # ignore contents
+                                },
                                 "noninvite_past.ics": {
                                     "@contents" : NON_INVITE_PAST_ICS,
                                 },
@@ -671,6 +686,9 @@
                                 ".db.sqlite": {
                                     "@contents" : None, # ignore contents
                                 },
+                                ".db.sqlite-journal": {
+                                    "@contents" : None, # ignore contents
+                                },
                                 "*.ics/UID:7ED97931-9A19-4596-9D4D-52B36D6AB803": {
                                     "@contents" : (
                                         "METHOD:CANCEL",
@@ -692,6 +710,9 @@
                                 ".db.sqlite": {
                                     "@contents" : None, # ignore contents
                                 },
+                                ".db.sqlite-journal": {
+                                    "@contents" : None, # ignore contents
+                                },
                                 "organizer.ics": {
                                     "@contents" : (
                                         "STATUS:CANCELLED",
@@ -811,6 +832,9 @@
                                 ".db.sqlite": {
                                     "@contents" : None, # ignore contents
                                 },
+                                ".db.sqlite-journal": {
+                                    "@contents" : None, # ignore contents
+                                },
                                 "noninvite.ics": { # event in the past
                                     "@contents" : NON_INVITE_ICS_3,
                                 },
@@ -846,6 +870,9 @@
                                 ".db.sqlite": {
                                     "@contents" : None, # ignore contents
                                 },
+                                ".db.sqlite-journal": {
+                                    "@contents" : None, # ignore contents
+                                },
                                 "*.ics/UID:7ED97931-9A19-4596-9D4D-52B36D6AB803": {
                                     "@contents" : (
                                         "METHOD:CANCEL",
@@ -862,6 +889,9 @@
                                 ".db.sqlite": {
                                     "@contents" : None, # ignore contents
                                 },
+                                ".db.sqlite-journal": {
+                                    "@contents" : None, # ignore contents
+                                },
                                 "organizer.ics": {
                                     # Purging non-existent organizer; has non-existent
                                     # and existent attendees

Modified: CalendarServer/trunk/twistedcaldav/sql.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/sql.py	2010-06-09 22:10:53 UTC (rev 5712)
+++ CalendarServer/trunk/twistedcaldav/sql.py	2010-06-09 22:17:47 UTC (rev 5713)
@@ -88,13 +88,20 @@
                     self._db_connection = sqlite.connect(db_filename, isolation_level=None)
                 else:
                     self._db_connection = sqlite.connect(db_filename)
+
             except DatabaseError:
                 raise DatabaseError("Unable to open database %s" % (self.dbpath,))
 
+            q = self._db_connection.cursor()
+
             #
+            # Set Journal mode to PERSIST to avoid constant unlink calls
+            #
+            q.execute("PRAGMA journal_mode = PERSIST")
+
+            #
             # Set up the schema
             #
-            q = self._db_connection.cursor()
             try:
                 # Create CALDAV table if needed
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100609/d0cdb50a/attachment.html>


More information about the calendarserver-changes mailing list