reset synchronous_standby_names on walmgr "stop".
authorMartin Pihlak <martin.pihlak@gmail.com>
Fri, 14 Oct 2011 14:20:53 +0000 (17:20 +0300)
committerMartin Pihlak <martin.pihlak@gmail.com>
Fri, 14 Oct 2011 14:20:53 +0000 (17:20 +0300)
python/walmgr.py

index f296e7ac952a0d82b5b88e4032d0c3503d49820f..7afc3c73aed7af95262ec8251356ca030da6d024 100755 (executable)
@@ -208,6 +208,19 @@ class PostgresConfiguration:
             return "off"
         return None
 
+    def synchronous_standby_names(self):
+        """Return value for specified parameter"""
+        # see if explicitly set
+        m = re.search("^\s*synchronous_standby_names\s*=\s*'?([a-zA-Z01]+)'?\s*#?.*$", self.cf_buf, re.M | re.I)
+        if m:
+            return m.group(1)
+        # also, it could be commented out as initdb leaves it
+        # it'd probably be best to check from the database ...
+        m = re.search("^#synchronous_standby_names\s*=.*$", self.cf_buf, re.M | re.I)
+        if m:
+            return ''
+        return None
+
     def wal_level(self):
         """Return value for specified parameter"""
         # see if explicitly set
@@ -722,6 +735,11 @@ class WalMgr(skytools.DBScript):
 
                 cf_params['archive_command'] = '/bin/true'
 
+                # disable synchronous standbys, note that presently we don't care
+                # if there is more than one standby.
+                if cf.synchronous_standby_names():
+                    cf_params['synchronous_standby_names'] = ''
+
         self.log.debug("modifying configuration: %s" % cf_params)
 
         cf.modify(cf_params)