提交 bd7150fe 编写于 作者: M Marbin Tan 提交者: Larry Hamel

Change arguments to postgres to use long flags

Make consistent with:
https://github.com/greenplum-db/gpdb/commit/d7e6e0ecac5c49d16c68fcb827a23b0116d07b5aSigned-off-by: NChumki Roy <croy@pivotal.io>
Signed-off-by: NC.J. Jameson <cjameson@pivotal.io>
上级 290db755
...@@ -2610,8 +2610,7 @@ class PrepFileSpaces(Command): ...@@ -2610,8 +2610,7 @@ class PrepFileSpaces(Command):
entry = [filespaceNames[i] , filespaceLocations[i]] entry = [filespaceNames[i] , filespaceLocations[i]]
self.filespaces.append(entry) self.filespaces.append(entry)
cmdStr = """echo "select * from gp_prep_new_segment( array %s )" """ % (str(self.filespaces)) cmdStr = """echo "select * from gp_prep_new_segment( array %s )" """ % (str(self.filespaces))
###cmdStr += """ | $GPHOME/bin/postgres --single -z 1 -O -c gp_session_role=utility -c gp_debug_linger=0 -c gp_before_filespace_setup=true -c gp_before_persistence_work=true -E -D %s -b %s -C %s template1""" % (self.sysDataDirectory, str(self.dbid), str(self.contentId)) cmdStr += """ | $GPHOME/bin/postgres --single --gp_num_contents_in_cluster=1 -O -c gp_session_role=utility -c gp_debug_linger=0 -c gp_before_filespace_setup=true -E -D %s --gp_dbid=%s --gp_contentid=%s template1""" % (self.sysDataDirectory, str(self.dbid), str(self.contentId))
cmdStr += """ | $GPHOME/bin/postgres --single -z 1 -O -c gp_session_role=utility -c gp_debug_linger=0 -c gp_before_filespace_setup=true -E -D %s -b %s -C %s template1""" % (self.sysDataDirectory, str(self.dbid), str(self.contentId))
Command.__init__(self,name,cmdStr,ctxt,remoteHost) Command.__init__(self,name,cmdStr,ctxt,remoteHost)
...@@ -2989,15 +2988,18 @@ def sig_handler(sig, arg): ...@@ -2989,15 +2988,18 @@ def sig_handler(sig, arg):
os.kill(os.getpid(), sig) os.kill(os.getpid(), sig)
#------------------------------- Mainline -------------------------------- # --------------------------------------------------------------------------
gp_expand=None # Main
remove_pid=True # --------------------------------------------------------------------------
table_expand_error=False if __name__ == '__main__':
gp_expand=None
remove_pid=True
table_expand_error=False
coverage = GpCoverage() coverage = GpCoverage()
coverage.start() coverage.start()
try: try:
# setup signal handlers so we can clean up correctly # setup signal handlers so we can clean up correctly
signal.signal(signal.SIGTERM, sig_handler) signal.signal(signal.SIGTERM, sig_handler)
...@@ -3122,13 +3124,13 @@ try: ...@@ -3122,13 +3124,13 @@ try:
logger.info("Exiting...") logger.info("Exiting...")
sys.exit(0) sys.exit(0)
except ValidationError: except ValidationError:
logger.info('Bringing Greenplum Database back online...') logger.info('Bringing Greenplum Database back online...')
if gp_expand is not None: if gp_expand is not None:
gp_expand.shutdown() gp_expand.shutdown()
gpexpand.get_gpdb_in_state(GPDB_STARTED) gpexpand.get_gpdb_in_state(GPDB_STARTED)
sys.exit() sys.exit()
except Exception,e: except Exception,e:
if options.verbose: if options.verbose:
logger.exception("gpexpand failed. exiting...") logger.exception("gpexpand failed. exiting...")
else: else:
...@@ -3144,7 +3146,7 @@ except Exception,e: ...@@ -3144,7 +3146,7 @@ except Exception,e:
logger.error('Please run \'gpexpand -r%s\' to rollback to the original state.' % ('' if not options.database else ' -D %s' % options.database)) logger.error('Please run \'gpexpand -r%s\' to rollback to the original state.' % ('' if not options.database else ' -D %s' % options.database))
gp_expand.shutdown() gp_expand.shutdown()
sys.exit(3) sys.exit(3)
except KeyboardInterrupt: except KeyboardInterrupt:
# Disable SIGINT while we shutdown. # Disable SIGINT while we shutdown.
signal.signal(signal.SIGINT,signal.SIG_IGN) signal.signal(signal.SIGINT,signal.SIG_IGN)
...@@ -3157,7 +3159,7 @@ except KeyboardInterrupt: ...@@ -3157,7 +3159,7 @@ except KeyboardInterrupt:
sys.exit('\nUser Interrupted') sys.exit('\nUser Interrupted')
finally: finally:
try: try:
if remove_pid: if remove_pid:
remove_pid_file(options.master_data_directory) remove_pid_file(options.master_data_directory)
......
import os
import imp
from gp_unittest import *
class GpExpand(GpTestCase):
def setUp(self):
# because gpexpand does not have a .py extension,
# we have to use imp to import it
# if we had a gpexpand.py, this is equivalent to:
# import gpexpand
# self.subject = gpexpand
gpexpand_file = os.path.abspath(os.path.dirname(__file__) + "/../../../gpexpand")
self.subject = imp.load_source('gpexpand', gpexpand_file)
def tearDown(self):
pass
def test_PrepFileSpaces_issues_correct_postgres_command(self):
prep_file_spaces = self.subject.PrepFileSpaces("name", [""], [""], "foo", 1, 1)
self.assertIn("--gp_contentid=", prep_file_spaces.cmdStr)
self.assertIn("--gp_num_contents_in_cluster=", prep_file_spaces.cmdStr)
self.assertIn("--gp_dbid=", prep_file_spaces.cmdStr)
if __name__ == '__main__':
run_tests()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册