[CalendarServer-changes] [6604] CalendarServer/branches/users/glyph/dont-start-postgres

source_changes at macosforge.org source_changes at macosforge.org
Wed Nov 10 18:55:15 PST 2010


Revision: 6604
          http://trac.macosforge.org/projects/calendarserver/changeset/6604
Author:   glyph at apple.com
Date:     2010-11-10 18:55:12 -0800 (Wed, 10 Nov 2010)
Log Message:
-----------
Remove unnecessary / redundant produceLocalTransaction method; just use a connection pool.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/caldav.py
    CalendarServer/branches/users/glyph/dont-start-postgres/txdav/base/datastore/subpostgres.py

Modified: CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/caldav.py	2010-11-11 02:54:59 UTC (rev 6603)
+++ CalendarServer/branches/users/glyph/dont-start-postgres/calendarserver/tap/caldav.py	2010-11-11 02:55:12 UTC (rev 6604)
@@ -850,18 +850,17 @@
             def subServiceFactory(connectionFactory):
                 # The database server is running at this point, so do the
                 # filesystem->database upgrade.
+                ms = ErrorLoggingMultiService()
+                cp = ConnectionPool(connectionFactory)
+                cp.setServiceParent(ms)
                 attachmentsRoot = dbRoot.child("attachments")
-                return UpgradeToDatabaseService.wrapService(
+                maybeUpgradeSvc = UpgradeToDatabaseService.wrapService(
                     CachingFilePath(config.DocumentRoot), mainService,
-                    # FIXME: somehow, this should be a connection pool too, not
-                    # unpooled connections; this only runs in the master
-                    # process, so this would be a good point to bootstrap that
-                    # whole process.  However, it's somewhat tricky to do that
-                    # right.  The upgrade needs to run in the master, before
-                    # any other things have run.
-                    pgserv.produceLocalTransaction, attachmentsRoot,
+                    cp.connection, attachmentsRoot,
                     uid=postgresUID, gid=postgresGID
                 )
+                maybeUpgradeSvc.setServiceParent(cp)
+                return maybeUpgradeSvc
             if os.getuid() == 0: # Only override if root
                 postgresUID = uid
                 postgresGID = gid

Modified: CalendarServer/branches/users/glyph/dont-start-postgres/txdav/base/datastore/subpostgres.py
===================================================================
--- CalendarServer/branches/users/glyph/dont-start-postgres/txdav/base/datastore/subpostgres.py	2010-11-11 02:54:59 UTC (rev 6603)
+++ CalendarServer/branches/users/glyph/dont-start-postgres/txdav/base/datastore/subpostgres.py	2010-11-11 02:55:12 UTC (rev 6604)
@@ -278,13 +278,6 @@
         return self._connectorFor(databaseName).connect(label)
 
 
-    def produceLocalTransaction(self, label="<unlabeled>"):
-        """
-        Create a L{IAsyncTransaction} based on a thread in the current process.
-        """
-        return UnpooledSqlTxn(lambda : self.produceConnection(label))
-
-
     def ready(self):
         """
         Subprocess is ready.  Time to initialize the subservice.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20101110/abc85fae/attachment.html>


More information about the calendarserver-changes mailing list