[CalendarServer-changes] [6055] CalendarServer/branches/users/glyph/sql-store

source_changes at macosforge.org source_changes at macosforge.org
Wed Aug 11 12:08:37 PDT 2010


Revision: 6055
          http://trac.macosforge.org/projects/calendarserver/changeset/6055
Author:   sagen at apple.com
Date:     2010-08-11 12:08:37 -0700 (Wed, 11 Aug 2010)
Log Message:
-----------
Lower the shared_buffers and max_connections postgres config options (drastically in the case of tests) so that multiple servers (and tests) can run.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/test_postgres.py
    CalendarServer/branches/users/glyph/sql-store/txdav/datastore/subpostgres.py
    CalendarServer/branches/users/glyph/sql-store/txdav/datastore/test/test_subpostgres.py

Modified: CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/test_postgres.py
===================================================================
--- CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/test_postgres.py	2010-08-11 16:59:42 UTC (rev 6054)
+++ CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/test_postgres.py	2010-08-11 19:08:37 UTC (rev 6055)
@@ -96,7 +96,8 @@
                     ready.callback(self.store)
                 return self.store
             self.sharedService = PostgresService(
-                dbRoot, getReady, v1_schema, "caldav", resetSchema=True
+                dbRoot, getReady, v1_schema, "caldav", resetSchema=True,
+                testMode=True
             )
             self.sharedService.startService()
             def startStopping():

Modified: CalendarServer/branches/users/glyph/sql-store/txdav/datastore/subpostgres.py
===================================================================
--- CalendarServer/branches/users/glyph/sql-store/txdav/datastore/subpostgres.py	2010-08-11 16:59:42 UTC (rev 6054)
+++ CalendarServer/branches/users/glyph/sql-store/txdav/datastore/subpostgres.py	2010-08-11 19:08:37 UTC (rev 6055)
@@ -158,7 +158,8 @@
 class PostgresService(MultiService):
 
     def __init__(self, dataStoreDirectory, subServiceFactory,
-                 schema, databaseName='subpostgres', resetSchema=False):
+                 schema, databaseName='subpostgres', resetSchema=False,
+                 testMode=False):
         """
         Initialize a L{PostgresService} pointed at a data store directory.
 
@@ -180,7 +181,19 @@
         self.monitor = None
         self.openConnections = []
 
+        # FIXME: By default there is very little (4MB) shared memory available,
+        # so at the moment I am lowering these postgres config options to allow
+        # multiple servers to run.  We might want to look into raising
+        # kern.sysv.shmmax.
+        # See: http://www.postgresql.org/docs/8.4/static/kernel-resources.html
+        if testMode:
+            self.sharedBuffers = 16
+            self.maxConnections = 2
+        else:
+            self.sharedBuffers = 30
+            self.maxConnections = 20
 
+
     def produceConnection(self, label="<unlabeled>", databaseName=None):
         """
         Produce a DB-API 2.0 connection pointed at this database.
@@ -291,8 +304,8 @@
                 "-w",
                 # XXX what are the quoting rules for '-o'?  do I need to repr()
                 # the path here?
-                "-o", "-c listen_addresses='' -k '%s' -c standard_conforming_strings=on"
-                    % (self.socketDir.path,),
+                "-o", "-c listen_addresses='' -k '%s' -c standard_conforming_strings=on -c shared_buffers=%d -c max_connections=%d"
+                    % (self.socketDir.path, self.sharedBuffers, self.maxConnections),
             ],
             self.env
         )

Modified: CalendarServer/branches/users/glyph/sql-store/txdav/datastore/test/test_subpostgres.py
===================================================================
--- CalendarServer/branches/users/glyph/sql-store/txdav/datastore/test/test_subpostgres.py	2010-08-11 16:59:42 UTC (rev 6054)
+++ CalendarServer/branches/users/glyph/sql-store/txdav/datastore/test/test_subpostgres.py	2010-08-11 19:08:37 UTC (rev 6055)
@@ -73,6 +73,7 @@
             SimpleService,
             "create table TEST_DUMMY_TABLE (stub varchar)",
             "dummy_db",
+            testMode=True
         )
 
         svc.startService()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100811/ebec1596/attachment.html>


More information about the calendarserver-changes mailing list