Disable archive_command in restored postgresql.conf
authorMartin Pihlak <martin.pihlak@gmail.com>
Tue, 15 Sep 2009 12:24:01 +0000 (15:24 +0300)
committerMartin Pihlak <martin.pihlak@gmail.com>
Tue, 15 Sep 2009 12:24:01 +0000 (15:24 +0300)
archive_command is set to /bin/true instead of disabling archive_mode
This avoids the extra reconfiguration restart when the slave is actually
booted and promoted to master. Based on patch by Mark Kirkwoord.

python/walmgr.py

index a8b0fbcb30245fd811587d83579f85d655552a58..958816f8e105249d051125696fa6d5507ea66238 100755 (executable)
@@ -37,16 +37,6 @@ Switches:
   -n                 no action, just print commands
 """
 
-"""
-Additional features:
- * Simplified install. Master "setup" command should setup slave directories.
- * Add support for multiple targets on master.
- * WAL purge does not correctly purge old WAL-s if timelines are involved. The first
- useful WAL name is obtained from backup_label, WAL-s in the same timeline that are older 
- than first useful WAL are removed. 
- * Always copy the directory on "restore" add a special "--move" option.
-"""
-
 import os, sys, skytools, re, signal, time, traceback
 import errno, glob, ConfigParser, shutil
 
@@ -550,15 +540,15 @@ class WalMgr(skytools.DBScript):
         cf.write()
 
     def slave_deconfigure_archiving(self, cf_file):
-        """Turn the archiving off for the slave"""
+        """Disable archiving for the slave. This is done by setting
+        archive_command to a trivial command, so that archiving can be
+        re-enabled without restarting postgres. Needed when slave is
+        booted with postgresql.conf from master."""
 
         self.log.debug("Disable archiving in %s" % cf_file)
 
         cf = PostgresConfiguration(self, cf_file)
-
-        cf_params = { "archive_command": "" }
-        if cf.archive_mode():
-            cf_params["archive_mode"] = "off"
+        cf_params = { "archive_command": "/bin/true" }
 
         self.log.debug("modifying configuration: %s" % cf_params)
         cf.modify(cf_params)