[CalendarServer-changes] [3276] CalendarServer/trunk/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Thu Oct 30 07:55:14 PDT 2008


Revision: 3276
          http://trac.macosforge.org/projects/calendarserver/changeset/3276
Author:   cdaboo at apple.com
Date:     2008-10-30 07:55:12 -0700 (Thu, 30 Oct 2008)
Log Message:
-----------
Don't do an explicit commit in _db_init as it will have already been done in _db_recreate.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/index.py
    CalendarServer/trunk/twistedcaldav/sql.py

Modified: CalendarServer/trunk/twistedcaldav/index.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/index.py	2008-10-30 14:30:50 UTC (rev 3275)
+++ CalendarServer/trunk/twistedcaldav/index.py	2008-10-30 14:55:12 UTC (rev 3276)
@@ -808,6 +808,9 @@
                     log.err("Non-calendar resource: %s" % (name,))
                 else:
                     #log.msg("Indexing resource: %s" % (name,))
-                    self.addResource(name, calendar)
+                    self.addResource(name, calendar, True)
             finally:
                 stream.close()
+
+        # Do commit outside of the loop for better performance
+        self._db_commit()

Modified: CalendarServer/trunk/twistedcaldav/sql.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/sql.py	2008-10-30 14:30:50 UTC (rev 3275)
+++ CalendarServer/trunk/twistedcaldav/sql.py	2008-10-30 14:55:12 UTC (rev 3276)
@@ -162,8 +162,7 @@
         # We need an exclusive lock here as we are making a big change to the database and we don't
         # want other processes to get stomped on or stomp on us.
         old_isolation = self._db_connection.isolation_level
-        self._db_connection.isolation_level = None
-        q.execute("begin exclusive transaction")
+        self._db_connection.isolation_level = "EXCLUSIVE"
         
         # We re-check whether the schema table is present again AFTER we've got an exclusive
         # lock as some other server process may have snuck in and already created it
@@ -173,7 +172,6 @@
             self._db_init_data_tables(q)
             self._db_recreate()
 
-        q.execute("commit")
         self._db_connection.isolation_level = old_isolation
 
     def _db_init_schema_table(self, q):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081030/267d0648/attachment.html>


More information about the calendarserver-changes mailing list