提交 1136f2fb 编写于 作者: S Shaoqi Bai 提交者: BaiShaoqi

After applying that commit 22e04dc12df9e0577ba93a75dbef160c8c1ed258, the...

After applying that commit 22e04dc12df9e0577ba93a75dbef160c8c1ed258, the master will block when the standby master is down.

There are a couple things that need to be done to unblock the master.
1. Run gpinitstandby -n to start the standby master back up.
2. Run psql postgres -c "ALTER SYSTEM SET synchronous_standby_names = '';" and reload the master segment.

Note that the ALTER SYSTEM SET has to be called again to set synchronous_standby_names back to '*' (and master config reloaded) to enable synchronous replication again.
Thoughts are to make it 1 step combined into gpinitstandby -n instead of documenting a multi-step process.

What this commit is just to make it 1 step combined into gpinitstandby -n.
Co-authored-by: NNing Yu <nyu@pivotal.io>
上级 7f6066ea
......@@ -338,6 +338,19 @@ def check_and_start_standby():
standby.port,
standby.dbid,
array.getNumSegmentContents())
# set synchronous_standby_names to '*'
cmd = gp.GpAddConfigScript('master',
array.master.datadir,
'synchronous_standby_names',
value="'*'",
removeonly=False,
ctxt=gp.REMOTE,
remoteHost=array.master.hostname,
autoconf=True)
cmd.run(validateAfter=True)
# make it effective
pg.ReloadDbConf.local('pg_ctl reload', array.master)
logger.info("Successfully started standby master")
#-------------------------------------------------------------------------
......
......@@ -976,7 +976,7 @@ class GpCatVersionDirectory(Command):
#-----------------------------------------------
class GpAddConfigScript(Command):
def __init__(self, name, directorystring, entry, value=None, removeonly=False, ctxt=LOCAL, remoteHost=None):
def __init__(self, name, directorystring, entry, value=None, removeonly=False, ctxt=LOCAL, remoteHost=None, autoconf=False):
cmdStr="echo '%s' | $GPHOME/sbin/gpaddconfig.py --entry %s" % (directorystring, entry)
if value:
# value will be encoded and unencoded in the script to protect against shell interpretation
......@@ -984,6 +984,8 @@ class GpAddConfigScript(Command):
cmdStr = cmdStr + " --value '" + value + "'"
if removeonly:
cmdStr = cmdStr + " --removeonly "
if autoconf:
cmdStr = cmdStr + " --autoconf "
Command.__init__(self,name,cmdStr,ctxt,remoteHost)
......
......@@ -33,6 +33,7 @@ def parseargs():
parser.add_option('--entry', type='string')
parser.add_option('--value', type='string')
parser.add_option('--removeonly', action='store_true')
parser.add_option('--autoconf', action='store_true')
parser.set_defaults(removeonly=False)
# Parse the command line arguments
......@@ -61,7 +62,10 @@ while line:
directory = line.rstrip()
filename = directory + "/postgresql.conf"
if options.autoconf:
filename = directory + "/postgresql.auto.conf"
else:
filename = directory + "/postgresql.conf"
if not os.path.exists(filename):
raise Exception("path does not exist" + filename)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册