[CalendarServer-changes] [11120] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed May 1 17:14:21 PDT 2013


Revision: 11120
          http://trac.calendarserver.org//changeset/11120
Author:   sagen at apple.com
Date:     2013-05-01 17:14:21 -0700 (Wed, 01 May 2013)
Log Message:
-----------
Don't initdb if DatabaseRoot already existed because that breaks backup/restore; make cluster directory name configurable

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tap/util.py
    CalendarServer/trunk/conf/caldavd-apple.plist
    CalendarServer/trunk/twistedcaldav/stdconfig.py
    CalendarServer/trunk/txdav/base/datastore/subpostgres.py

Modified: CalendarServer/trunk/calendarserver/tap/util.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/util.py	2013-05-02 00:02:24 UTC (rev 11119)
+++ CalendarServer/trunk/calendarserver/tap/util.py	2013-05-02 00:14:21 UTC (rev 11120)
@@ -125,6 +125,7 @@
     return PostgresService(
         dbRoot, subServiceFactory, current_sql_schema,
         databaseName=config.Postgres.DatabaseName,
+        clusterName=config.Postgres.ClusterName,
         logFile=config.Postgres.LogFile,
         socketDir=config.RunRoot,
         listenAddresses=config.Postgres.ListenAddresses,

Modified: CalendarServer/trunk/conf/caldavd-apple.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-apple.plist	2013-05-02 00:02:24 UTC (rev 11119)
+++ CalendarServer/trunk/conf/caldavd-apple.plist	2013-05-02 00:14:21 UTC (rev 11120)
@@ -114,12 +114,18 @@
         </array>
         <key>ExtraConnections</key>
         <integer>20</integer>
+        <key>ClusterName</key>
+        <string>cluster.pg</string>
     </dict>
 
     <!-- Data root -->
     <key>DataRoot</key>
     <string>Data</string>
 
+    <!-- Database root -->
+    <key>DatabaseRoot</key>
+    <string>Database.xpg</string>
+
     <!-- Document root -->
     <key>DocumentRoot</key>
     <string>Documents</string>

Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py	2013-05-02 00:02:24 UTC (rev 11119)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py	2013-05-02 00:14:21 UTC (rev 11120)
@@ -909,6 +909,7 @@
 
     "Postgres": {
         "DatabaseName": "caldav",
+        "ClusterName": "cluster",
         "LogFile": "postgres.log",
         "ListenAddresses": [],
         "SharedBuffers": 0, # BuffersToConnectionsRatio * MaxConnections

Modified: CalendarServer/trunk/txdav/base/datastore/subpostgres.py
===================================================================
--- CalendarServer/trunk/txdav/base/datastore/subpostgres.py	2013-05-02 00:02:24 UTC (rev 11119)
+++ CalendarServer/trunk/txdav/base/datastore/subpostgres.py	2013-05-02 00:14:21 UTC (rev 11120)
@@ -158,6 +158,7 @@
 
     def __init__(self, dataStoreDirectory, subServiceFactory,
                  schema, resetSchema=False, databaseName='subpostgres',
+                 clusterName="cluster",
                  logFile="postgres.log", socketDir="/tmp",
                  listenAddresses=[], sharedBuffers=30,
                  maxConnections=20, options=[],
@@ -205,6 +206,7 @@
 
         # Options from config
         self.databaseName = databaseName
+        self.clusterName = clusterName
         # Make logFile absolute in case the working directory of postgres is
         # elsewhere:
         self.logFile = os.path.abspath(logFile)
@@ -457,7 +459,7 @@
     def startService(self):
         MultiService.startService(self)
         self.activateDelayedShutdown()
-        clusterDir = self.dataStoreDirectory.child("cluster")
+        clusterDir = self.dataStoreDirectory.child(self.clusterName)
         env = self.env = os.environ.copy()
         env.update(PGDATA=clusterDir.path,
                    PGHOST=self.host,
@@ -468,11 +470,10 @@
                 self.socketDir.createDirectory()
             if self.uid and self.gid:
                 os.chown(self.socketDir.path, self.uid, self.gid)
-        if clusterDir.isdir():
+        if self.dataStoreDirectory.isdir():
             self.startDatabase()
         else:
-            if not self.dataStoreDirectory.isdir():
-                self.dataStoreDirectory.createDirectory()
+            self.dataStoreDirectory.createDirectory()
             if not self.workingDir.isdir():
                 self.workingDir.createDirectory()
             if self.uid and self.gid:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130501/da05bee5/attachment.html>


More information about the calendarserver-changes mailing list