summaryrefslogtreecommitdiff
path: root/python/walmgr.py
diff options
context:
space:
mode:
authorMartin Pihlak2011-10-14 14:20:53 +0000
committerMartin Pihlak2011-10-14 14:20:53 +0000
commit0359c8a080f570eae0280fd557f269d0896c2551 (patch)
treebc87eb9cf077f9fec5b473371f3778a08dd42fca /python/walmgr.py
parent40ebc6435fce6da1016ec545a58294469d850376 (diff)
reset synchronous_standby_names on walmgr "stop".
Diffstat (limited to 'python/walmgr.py')
-rwxr-xr-xpython/walmgr.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/python/walmgr.py b/python/walmgr.py
index f296e7ac..7afc3c73 100755
--- a/python/walmgr.py
+++ b/python/walmgr.py
@@ -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)