提交 f5f28b20 编写于 作者: N Nadeem Ghani 提交者: Nadeem Ghani

delete unused command wrappers and functions

上级 aa032406
......@@ -704,22 +704,6 @@ class GpStandbyStart(MasterStart, object):
cmd.run(validateAfter=True)
return cmd
#-----------------------------------------------
class GpInitSystem(Command):
def __init__(self,name,configFile,hostsFile, ctxt=LOCAL, remoteHost=None):
self.configFile=configFile
self.hostsFile=hostsFile
self.cmdStr="$GPHOME/bin/gpinitsystem -a -c %s -h %s" % (configFile,hostsFile)
Command.__init__(self, name, self.cmdStr, ctxt, remoteHost)
#-----------------------------------------------
class GpDeleteSystem(Command):
def __init__(self,name,datadir, ctxt=LOCAL, remoteHost=None):
self.datadir=datadir
self.input="y\ny\n"
self.cmdStr="$GPHOME/bin/gpdeletesystem -d %s -f " % (datadir)
Command.__init__(self, name, self.cmdStr, ctxt, remoteHost,stdin=self.input)
#-----------------------------------------------
class GpStart(Command):
def __init__(self, name, masterOnly=False, restricted=False, verbose=False,ctxt=LOCAL, remoteHost=None):
......@@ -812,39 +796,6 @@ class GpStop(Command):
cmd.run(validateAfter=True)
return cmd
#-----------------------------------------------
class GpRecoverseg(Command):
def __init__(self, name, ctxt=LOCAL, remoteHost=None):
self.cmdStr = "$GPHOME/bin/gprecoverseg -a"
Command.__init__(self, name, self.cmdStr, ctxt, remoteHost)
#-----------------------------------------------
class Psql(Command):
def __init__(self, name, query=None, filename=None, database='template1', port=None, utilityMode=False, ctxt=LOCAL, remoteHost=None):
env = ''
if utilityMode:
env = 'PGOPTIONS="-c gp_session_role=utility"'
cmdStr = '%s $GPHOME/bin/psql ' % env
if port is not None:
cmdStr += '-p %d ' % port
if query is not None and filename is not None:
raise Exception('Psql can accept only a query or a filename, not both.')
elif query is not None:
cmdStr += '-c "%s" ' % query
elif filename is not None:
cmdStr += '-f %s ' % filename
else:
raise Exception('Psql must be passed a query or a filename.')
# shell escape and force double quote of database in case of any funny chars
cmdStr += '"%s" ' % shellEscape(database)
# Need to escape " for REMOTE or it'll interfere with ssh
if ctxt == REMOTE:
cmdStr = cmdStr.replace('"', '\\"')
self.cmdStr=cmdStr
Command.__init__(self, name, self.cmdStr, ctxt, remoteHost)
#-----------------------------------------------
class ModifyPostgresqlConfSetting(Command):
def __init__(self, name, file, optName, optVal, optType='string', ctxt=LOCAL, remoteHost=None):
......@@ -1067,8 +1018,6 @@ class GpAppendGucToFile(Command):
cmdStr = 'echo "%s=%s" >> %s' % (guc, finalText, file)
Command.__init__(self,name,cmdStr,ctxt,remoteHost)
#-----------------------------------------------
class GpLogFilter(Command):
def __init__(self, name, filename, start=None, end=None, duration=None,
case=None, count=None, search_string=None,
......@@ -1096,11 +1045,9 @@ class GpLogFilter(Command):
if trouble:
cmdfrags.append('-t')
cmdfrags.append(filename)
self.cmdStr = "$GPHOME/bin/gplogfilter %s" % ' '.join(cmdfrags)
self.cmdStr = "$GPHOME/bin/gplogfilter %s" % ' '.join(cmdfrags)
Command.__init__(self, name, self.cmdStr, ctxt,remoteHost)
@staticmethod
@staticmethod
def local(name, filename, start=None, end=None, duration=None,
case=None, count=None, search_string=None,
exclude_string=None, search_regex=None, exclude_regex=None,
......@@ -1422,63 +1369,6 @@ def read_postmaster_pidfile(datadir, host=None):
return pid
def pausePg(db):
"""
This function will pause an instance of postgres which is part of a GPDB
1) pause the postmaster (this prevents new connections from being made)
2) get list of processes that are descendent from postmaster process
3) pause all descendent processes and ignore any failures (a process may have died betwen getting pid list and doing the pauses)
4) again, get list of processes that are descendent from postmaster process
5) pause all descendent processes and ignore any failures (do not ignore errors, errors are failures, no pids can die between being paused the first time and getting the pid list)
"""
datadir = db.getSegmentDataDirectory()
content = db.getSegmentContentId()
postmasterPID = read_postmaster_pidfile(datadir)
if postmasterPID == 0:
raise Exception, 'print "could not locate postmasterPID during pause'
Kill.local(name="pausep "+str(content), pid=postmasterPID, signal="STOP")
decsendentProcessPids = getDescendentProcesses(postmasterPID)
for killpid in decsendentProcessPids:
try:
Kill.local(name="pausep "+str(killpid), pid=killpid, signal="STOP")
except:
pass
decsendentProcessPids = getDescendentProcesses(postmasterPID)
for killpid in decsendentProcessPids:
Kill.local(name="pausep "+str(killpid), pid=killpid, signal="STOP")
def resumePg(db):
"""
1) resume the processes descendent from the postmaster process
2) resume the postmaster process
"""
datadir = db.getSegmentDataDirectory()
content = db.getSegmentContentId()
postmasterPID = read_postmaster_pidfile(datadir)
if postmasterPID == 0:
raise Exception, 'print "could not locate postmasterPID during resume'
decsendentProcessPids = getDescendentProcesses(postmasterPID)
for killpid in decsendentProcessPids:
Kill.local(name="pausep "+str(killpid), pid=killpid, signal="CONT")
Kill.local(name="pausep "+str(content), pid=postmasterPID, signal="CONT")
def createTempDirectoryName(masterDataDirectory, tempDirPrefix):
return '%s/%s_%s_%d' % (os.sep.join(os.path.normpath(masterDataDirectory).split(os.sep)[:-1]),
tempDirPrefix,
......
......@@ -2,7 +2,7 @@ import sys
import signal
from gppylib.gparray import GpArray
from gppylib.db import dbconn
from gppylib.commands.gp import GpSegStopCmd, GpRecoverseg
from gppylib.commands.gp import GpSegStopCmd
from gppylib.commands import base
from gppylib import gplog
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册