You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by rl...@apache.org on 2015/11/14 08:41:39 UTC
[1/3] incubator-hawq git commit: HAWQ-158. Remove legacy command line
tools and help.
Repository: incubator-hawq
Updated Branches:
refs/heads/master cfeba473a -> 3691f2367
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/sbin/gpcleansegmentdir.py
----------------------------------------------------------------------
diff --git a/tools/sbin/gpcleansegmentdir.py b/tools/sbin/gpcleansegmentdir.py
deleted file mode 100755
index 9653c68..0000000
--- a/tools/sbin/gpcleansegmentdir.py
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (c) Greenplum Inc 2010. All Rights Reserved.
-#
-#
-# THIS IMPORT MUST COME FIRST
-# import mainUtils FIRST to get python version check
-#
-from gppylib.mainUtils import *
-
-from gppylib.gplog import *
-from gppylib.commands import unix
-import pickle, base64
-from gppylib import gparray
-from gppylib.gpparseopts import OptChecker,OptParser,OptParser
-from gppylib.operations.buildMirrorSegments import gDatabaseDirectories, gDatabaseFiles
-
-logger = get_default_logger()
-
-class GpCleanSegmentDirectoryProgram:
- """
- Clean up segment directories on a single host
-
- The caller should have already stopped the segments before calling this.
- """
-
- def __init__(self, options):
- self.__options = options
-
- def run(self):
- if self.__options.pickledArguments is None:
- raise ProgramArgumentValidationException("-p argument is missing")
-
- segments = pickle.loads(base64.urlsafe_b64decode(self.__options.pickledArguments))
-
- logger.info("Cleaning main data directories")
- for segment in segments:
- dir = segment.getSegmentDataDirectory()
- logger.info("Cleaning %s" % dir)
-
- for toClean in gDatabaseDirectories:
- if toClean != "pg_log":
- unix.RemoveFiles('clean segment', os.path.join(dir, toClean)).run( validateAfter=True )
- for toClean in gDatabaseFiles:
- unix.RemoveFiles('clean segment', os.path.join(dir, toClean)).run( validateAfter=True )
-
- for segment in segments:
- for filespaceOid, dir in segment.getSegmentFilespaces().iteritems():
- if filespaceOid != gparray.SYSTEM_FILESPACE:
- #
- # delete entire filespace directory -- filerep code on server will recreate it
- #
- unix.RemoveFiles('clean segment filespace dir', dir ).run( validateAfter=True )
-
- def cleanup(self):
- pass
-
- #-------------------------------------------------------------------------
- @staticmethod
- def createParser():
-
- description = ("""
- Clean segment directories.
- """)
-
- help = ["""
- To be used internally only.
- """]
-
- parser = OptParser(option_class=OptChecker,
- description=' '.join(description.split()),
- version='%prog version $Revision: #1 $')
- parser.setHelp(help)
-
- addStandardLoggingAndHelpOptions(parser, True)
-
- addTo = OptionGroup(parser, "Clean Segment Options")
- parser.add_option_group(addTo)
- addTo.add_option('-p', None, dest="pickledArguments",
- type='string', default=None, metavar="<pickledArguments>",
- help="The arguments passed from the original script")
-
- parser.set_defaults()
- return parser
-
-
- @staticmethod
- def createProgram(options, args):
- if len(args) > 0 :
- raise ProgramArgumentValidationException("too many arguments: only options may be specified")
- return GpCleanSegmentDirectoryProgram(options)
-
-#-------------------------------------------------------------------------
-if __name__ == '__main__':
- mainOptions = { 'setNonuserOnToolLogger': True}
- simple_main( GpCleanSegmentDirectoryProgram.createParser, GpCleanSegmentDirectoryProgram.createProgram, mainOptions)
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/sbin/gpgetstatususingtransition.py
----------------------------------------------------------------------
diff --git a/tools/sbin/gpgetstatususingtransition.py b/tools/sbin/gpgetstatususingtransition.py
deleted file mode 100755
index 46aae6f..0000000
--- a/tools/sbin/gpgetstatususingtransition.py
+++ /dev/null
@@ -1,221 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (c) Greenplum Inc 2010. All Rights Reserved.
-#
-#
-# THIS IMPORT MUST COME FIRST
-# import mainUtils FIRST to get python version check
-#
-from gppylib.mainUtils import *
-import os, sys
-
-import pickle, base64, figleaf
-
-from optparse import Option, OptionGroup, OptionParser, OptionValueError
-
-from gppylib.gpparseopts import OptParser, OptChecker
-from gppylib import gplog, gparray, pgconf
-from gppylib.commands import base, gp, pg, unix
-from gppylib.db import catalog, dbconn
-from gppylib.utils import parseKeyColonValueLines
-
-logger = gplog.get_default_logger()
-
-#
-# todo: the file containing this should be renamed since it gets more status than just from transition
-#
-class GpSegStatusProgram:
- """
-
- Program to fetch status from the a segment(s).
-
- Multiple pieces of status information can be fetched in a single request by
- passing in multiple status request options on the command line
-
- """
-
- def __init__(self, options):
- self.__options = options
- self.__pool = None
-
- def getStatusUsingTransition(self, seg, statusRequest, currentPMPidData):
- """
- The data as from GpSegStatusProgram.getPidRunningStatus
- """
- if currentPMPidData is not None and \
- (currentPMPidData['pidValue'] == 0 or not currentPMPidData['lockFileExists'] or not currentPMPidData['netstatPortActive']):
- logger.warn("Error getting data from segment %s; it is not running" % seg.getSegmentDataDirectory())
- return None
-
- cmd = gp.SendFilerepTransitionStatusMessage("Check Status", statusRequest, seg.getSegmentDataDirectory(),
- seg.getSegmentPort())
-
- cmd.run()
- return cmd.unpackSuccessLine()
-
- def getPidStatus(self, seg, pidRunningStatus):
- """
- returns a dict containing "pid" and "error" fields. Note that
- the "error" field may be non-None even when pid is non-zero (pid if zero indicates
- unable to determine the pid). This can happen if the pid is there in the
- lock file but not active on the port.
-
- The caller can rely on this to try to differentiate between an active pid and an inactive one
-
- """
-
- lockFileExists = pidRunningStatus['lockFileExists']
- netstatPortActive = pidRunningStatus['netstatPortActive']
- pidValue = pidRunningStatus['pidValue']
-
- lockFileName = gp.get_lockfile_name(seg.getSegmentPort())
-
- error = None
- if not lockFileExists and not netstatPortActive:
- error = "No socket connection or lock file (%s) found for port %s" % (lockFileName, seg.getSegmentPort())
- elif not lockFileExists and netstatPortActive:
- error = "No lock file %s but process running on port %s" % (lockFileName, seg.getSegmentPort())
- elif lockFileExists and not netstatPortActive:
- error = "Have lock file %s but no process running on port %s" % (lockFileName, seg.getSegmentPort())
- else:
- if pidValue == 0:
- error = "Have lock file and process is active, but did not get a pid value" # this could be an assert?
-
- res = {}
- res['pid'] = pidValue
- res['error'] = error
- return res
-
-
- def getPidRunningStatus(self, seg):
- """
- Get an object containing various information about the postmaster pid's status
- """
- (postmasterPidFileExists, tempFileExists, lockFileExists, netstatPortActive, pidValue) = \
- gp.chk_local_db_running(seg.getSegmentDataDirectory(), seg.getSegmentPort())
-
- return {
- 'postmasterPidFileExists' : postmasterPidFileExists,
- 'tempFileExists' : tempFileExists,
- 'lockFileExists' : lockFileExists,
- 'netstatPortActive' : netstatPortActive,
- 'pidValue' : pidValue
- }
-
- def __processMirrorStatusOutput(self, str):
- data = parseKeyColonValueLines(str)
-
- if data is None:
- return data
-
- # verify that all expected ones are there
- for expected in ["mode","segmentState","dataState", "postmasterState", "databaseStatus", "isFullResync", \
- "resyncNumCompleted","resyncTotalToComplete","estimatedCompletionTimeSecondsSinceEpoch", \
- "changeTrackingBytesUsed","verificationStatus","verificationMode",
- "verificationStartTimeSecondsSinceEpoch", "verificationCompletedCount", "verificationTotalCount",
- "estimatedCompletionVerificationTimeSecondsSinceEpoch"]:
- if expected not in data:
- logger.warn("Missing data key %s from str %s" % (expected, str))
- return None
-
- # convert some to long integers
- for toConvert in ["resyncNumCompleted","resyncTotalToComplete","estimatedCompletionTimeSecondsSinceEpoch", \
- "changeTrackingBytesUsed"]:
- value = data[toConvert]
- try:
- data[toConvert] = long(value)
- except ValueError:
- logger.warn("Invalid integer value %s from str %s" % (value, str))
- return None
-
- # convert some to booleans
- for toConvert in ["isFullResync"]:
- if data[toConvert] != "1" and data[toConvert] != "0":
- logger.warn("Invalid boolean str %s" % (str))
- return None
- data[toConvert] = (data[toConvert] == "1")
-
- return data
-
- def run(self):
-
- if self.__options.statusQueryRequests is None:
- raise ProgramArgumentValidationException("-s argument not specified")
- if self.__options.dirList is None:
- raise ProgramArgumentValidationException("-D argument not specified")
-
- toFetch = self.__options.statusQueryRequests.split(":")
- segments = map(gparray.GpDB.initFromString, self.__options.dirList)
-
- output = {}
- for seg in segments:
- pidRunningStatus = self.getPidRunningStatus(seg)
-
- outputThisSeg = output[seg.getSegmentDbId()] = {}
- for statusRequest in toFetch:
- data = None
- if statusRequest == gp.SEGMENT_STATUS__GET_VERSION:
- data = self.getStatusUsingTransition(seg, statusRequest, pidRunningStatus)
- if data is not None:
- data = data.rstrip()
-
- elif statusRequest == gp.SEGMENT_STATUS__GET_MIRROR_STATUS:
- data = self.getStatusUsingTransition(seg, statusRequest, pidRunningStatus)
- if data is not None:
- data = self.__processMirrorStatusOutput(data)
-
- elif statusRequest == gp.SEGMENT_STATUS__GET_PID:
- data = self.getPidStatus(seg, pidRunningStatus)
-
- elif statusRequest == gp.SEGMENT_STATUS__HAS_POSTMASTER_PID_FILE:
- data = pidRunningStatus['postmasterPidFileExists']
-
- elif statusRequest == gp.SEGMENT_STATUS__HAS_LOCKFILE:
- data = pidRunningStatus['lockFileExists']
-
- else:
- raise Exception("Invalid status request %s" % statusRequest )
-
- outputThisSeg[statusRequest] = data
-
- status = '\nSTATUS_RESULTS:' + base64.urlsafe_b64encode(pickle.dumps(output))
- logger.info(status)
-
- def cleanup(self):
- if self.__pool:
- self.__pool.haltWork()
-
- @staticmethod
- def createParser():
- parser = OptParser(option_class=OptChecker,
- description="Gets status from segments on a single host "
- "using a transition message. Internal-use only.",
- version='%prog version $Revision: #1 $')
- parser.setHelp([])
-
- addStandardLoggingAndHelpOptions(parser, True)
-
- addTo = parser
- addTo.add_option("-s", None, type="string",
- dest="statusQueryRequests",
- metavar="<statusQueryRequests>",
- help="Status Query Message")
- addTo.add_option("-D", "--dblist", type="string", action="append",
- dest="dirList",
- metavar="<dirList>",
- help="Directory List")
-
- parser.set_defaults()
- return parser
-
- @staticmethod
- def createProgram(options, args):
- if len(args) > 0 :
- raise ProgramArgumentValidationException(\
- "too many arguments: only options may be specified", True)
- return GpSegStatusProgram(options)
-
-#-------------------------------------------------------------------------
-if __name__ == '__main__':
- mainOptions = { 'setNonuserOnToolLogger':True}
- simple_main( GpSegStatusProgram.createParser, GpSegStatusProgram.createProgram, mainOptions)
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/sbin/gpoperation.py
----------------------------------------------------------------------
diff --git a/tools/sbin/gpoperation.py b/tools/sbin/gpoperation.py
deleted file mode 100755
index 9fcb99f..0000000
--- a/tools/sbin/gpoperation.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env python
-import sys
-import pickle
-import traceback
-
-class NullDevice():
- def write(self, s):
- pass
-
-# Prevent use of stdout, as it disrupts pickling mechanism
-old_stdout = sys.stdout
-sys.stdout = NullDevice()
-
-# log initialization must be done only AFTER rerouting stdout
-from gppylib import gplog
-from gppylib.mainUtils import getProgramName
-from gppylib.commands import unix
-hostname = unix.getLocalHostname()
-username = unix.getUserName()
-execname = pickle.load(sys.stdin)
-gplog.setup_tool_logging(execname, hostname, username)
-logger = gplog.get_default_logger()
-
-operation = pickle.load(sys.stdin)
-
-from gppylib.gpcoverage import GpCoverage
-coverage = GpCoverage()
-coverage.start()
-
-try:
- ret = operation.run()
-except Exception, e:
- exc_type, exc_value, exc_traceback = sys.exc_info()
- tb_list = traceback.extract_tb(exc_traceback)
- try:
- # TODO: Build an ExceptionCapsule that can return the traceback
- # to RemoteOperation as well. See Pyro.
-
- # logger.exception(e) # logging 'e' could be necessary for traceback
-
- pickled_ret = pickle.dumps(e) # Pickle exception for stdout transmission
- except Exception, f:
- # logger.exception(f) # 'f' is not important to us, except for debugging perhaps
-
- # No hope of pickling a precise Exception back to RemoteOperation.
- # So, provide meaningful trace as text and provide a non-zero return code
- # to signal to RemoteOperation that its Command invocation of gpoperation.py has failed.
- pretty_trace = str(e) + "\n"
- pretty_trace += 'Traceback (most recent call last):\n'
- pretty_trace += ''.join(traceback.format_list(tb_list))
- logger.critical(pretty_trace)
- print >> sys.stderr, pretty_trace
- sys.exit(2) # signal that gpoperation.py has hit unexpected error
-else:
- pickled_ret = pickle.dumps(ret) # Pickle return data for stdout transmission
-finally:
- coverage.stop()
- coverage.generate_report()
-
-sys.stdout = old_stdout
-print pickled_ret
-sys.exit(0)
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/sbin/gpsetdbid.py
----------------------------------------------------------------------
diff --git a/tools/sbin/gpsetdbid.py b/tools/sbin/gpsetdbid.py
deleted file mode 100755
index 3c44a0e..0000000
--- a/tools/sbin/gpsetdbid.py
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/usr/bin/env python
-'''
-Copyright (c) Greenplum Inc 2010. All Rights Reserved.
-
-This is a private script called by the Greenplum Management scripts.
-
-With the script you can create the gp_dbid file within a segment's data
-directory.
-
-This script does NOT modify the configuration information stored within
-the database.
-'''
-
-import os
-
-from optparse import OptionGroup
-from gppylib.gp_dbid import writeGpDbidFile
-from gppylib.mainUtils import *
-from gppylib.gpparseopts import OptParser, OptChecker
-from gppylib.gplog import get_logger_if_verbose
-
-__help__ = [""]
-
-#------------------------------- GpSetDBId --------------------------------
-class GpSetDBId:
- """
- Setup a gp_dbid file for a specified directory.
- """
-
- def __init__(self, options):
- self.__directory = options.directory
- self.__dbid = options.dbid
-
- def run(self):
- writeGpDbidFile(self.__directory, self.__dbid, logger=get_logger_if_verbose())
-
- def cleanup(self):
- pass
-
- #-------------------------------------------------------------------------
- @staticmethod
- def createParser():
- """
- Constructs and returns an option parser.
-
- Called by simple_main()
- """
- parser = OptParser(option_class=OptChecker,
- version='%prog version $Revision: $')
- parser.setHelp(__help__)
-
- addStandardLoggingAndHelpOptions(parser, False)
-
- opts = OptionGroup(parser, "Required Options")
- opts.add_option('-d', '--directory', type='string')
- opts.add_option('-i', '--dbid', type='int')
- parser.add_option_group(opts)
-
- parser.set_defaults()
- return parser
-
-
- #-------------------------------------------------------------------------
- @staticmethod
- def createProgram(options, args):
- """
- Construct and returns a GpSetDBId object.
-
- Called by simple_main()
- """
-
- # sanity check
- if len(args) > 0 :
- raise ProgramArgumentValidationException(
- "too many arguments: only options may be specified")
- if not options.directory:
- raise ProgramArgumentValidationException("--directory is required")
- if not options.dbid:
- raise ProgramArgumentValidationException("--dbid is required")
- return GpSetDBId(options)
-
-
-#------------------------------- Mainline --------------------------------
-if __name__ == '__main__':
- mainOptions = {
- 'suppressStartupLogMessage': True,
- 'useHelperToolLogging': True
- }
- simple_main(GpSetDBId.createParser,
- GpSetDBId.createProgram,
- mainOptions)
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/sbin/gpstandbywatch.py
----------------------------------------------------------------------
diff --git a/tools/sbin/gpstandbywatch.py b/tools/sbin/gpstandbywatch.py
deleted file mode 100755
index a4285b1..0000000
--- a/tools/sbin/gpstandbywatch.py
+++ /dev/null
@@ -1,220 +0,0 @@
-#!/usr/bin/env python
-# Line too long - pylint: disable=C0301
-# Invalid name - pylint: disable=C0103
-
-"""
- gpstandbywatch.py
- Copyright (c) EMC/Greenplum Inc 2011. All Rights Reserved.
-
- Check actual contents and process state of syncmaster
- in order to properly return accurate information back to
- gpinitstandby via gpstart.
-"""
-
-import os
-import sys
-import glob
-import time
-
-from gppylib.gplog import setup_tool_logging, get_default_logger
-from gppylib.commands import gp, unix
-
-
-def matching_files(pglogdir, ignore=None, setlimit=False):
- """
- Generate a series of file names corresponding to files
- in 'pglogdir' which are not in the specified 'ignore' map.
-
- Note that startup.log is always returned if present.
-
- If 'setlimit' is not false, files whose modification time
- exceeds the ctime of startup.log will also be ignored.
- """
- mlimit = None
- pattern = os.path.join(pglogdir, 'startup.log')
- for path in glob.glob(pattern):
- if setlimit:
- mlimit = os.stat(path).st_ctime
- yield path
-
- pattern = os.path.join(pglogdir, '*.csv')
- for path in glob.glob(pattern):
- if ignore is not None and path in ignore:
- continue
- if mlimit is not None and os.stat(path).st_mtime >= mlimit:
- continue
- yield path
-
-
-def updated_files(pglogdir, ignore, prev):
- """
- Generate a series of (time, path) tuples corresponding to files
- in 'pglogdir' and not in 'ignore' which were also modified
- after 'prev' (or all files if 'prev' is None).
- """
- for path in matching_files(pglogdir, ignore):
- ts = os.stat(path).st_mtime
- if prev is None or prev < ts:
- yield (ts, path)
-
-
-def updated_handles(pglogdir, ignore, prev, handles):
- """
- Generate a series of (time, handle) tuples corresponding to files
- in 'pglogdir' and not in 'ignore' modified after 'prev'
- (or all files if 'prev' is None).
- """
- for ts, path in updated_files(pglogdir, ignore, prev):
- h = handles.get(path, None)
- if h is None:
- h = open(path, 'r')
- handles[path] = h
- yield (ts, h)
-
-
-
-class SyncmasterWatcher:
- """
- Watch changes to files in the pg_log directory recorded by the gpsyncmaster.
- """
-
- def __init__(self, datadir):
- """
- Build a map containing the existing contents of the pg_log
- directory so that we can avoid getting confused by them
- after we start the syncmaster.
- """
- self.datadir = datadir
- self.pglogdir = os.path.join(self.datadir, 'pg_log')
-
- # note use of setlimit=True here to prevent any files created
- # after startup.log from becoming ignored.
- self.ignore = {}
- for path in matching_files( self.pglogdir, setlimit=True ):
- self.ignore[path] = True
-
- self.handles = {}
- self.maxlines = 1000
- self.timelimit = 10
- self.delay = 0.1
-
-
- def tail_briefly(self):
- """
- Generate lines recently added to log files in the pg_log directory
- updated after our __init__ constructor was called.
- """
- start = time.time() # starting time
- elapsed = 0 # time elapsed so far
- count = 0 # number of lines we've seen
- tp = None
-
- # until we're out of time or have returned enough lines
- while elapsed < self.timelimit and count < self.maxlines:
-
- # for each file modified since we last checked
- tn = None
- for ts, h in updated_handles(self.pglogdir, self.ignore, tp, self.handles):
-
- # track the last file modification time
- if tn is None or tn < ts:
- tn = ts
-
- # yield the new lines to the caller
- while count < self.maxlines:
- line = h.readline()
- if not line:
- break
- yield line
- count += 1
-
- # update the elapsed time
- elapsed = time.time() - start
-
- # if any new lines, update prev and keep checking for more
- if tn is not None:
- tp = tn
- continue
-
- # if we get here it means none of the files were updated in
- # our last iteration. sleep a moment before checking for
- # more updates
- time.sleep(self.delay)
-
-
-
- def monitor_logs(self):
- """
- Read the syncmaster log files for a few seconds, looking for
- potential problems.
-
- Returns 0 if no problems were seen or or 1 if the startup log
- contained an error or if the gpsyncmaster process exited before
- we were done watching.
- """
- logger.info("Monitoring logs")
-
- # now scan some of the syncmaster output for a moment
- for line in self.tail_briefly():
-
- if line.startswith('Traceback'): # gpsyncmaster traceback recorded
- logger.warning(line)
- return 1
-
- # MPP-13212 - since the syncmaster reports rejected client connections
- # as 'FATAL' errors, the presence of a 'FATAL' error need not indicate
- # a problem in the syncmaster so we comment out the following logic:
- #
- # if line.find('FATAL') >= 0: # fatal error recorded
- # logger.warning(line)
- # return 1
- #
- # This is especially important for health monitoring clients which may
- # rely on the difference between a rejected connection and a TCP failure.
-
- if line.find('could not bind IPv4 socket') >= 0: # syncmaster used IPv6 by mistake
- logger.warning(line)
- return 1
-
- if line.find('QDSYNC: scan forward') >= 0: # syncmaster appears to be working
- logger.info(line)
- break
-
- logger.info("checking if syncmaster is running")
- pid = gp.getSyncmasterPID('localhost', self.datadir)
- if not pid > 0:
- logger.warning("syncmaster not running")
- return 1
-
- # syncmaster is running and there are no obvious errors in the log
- logger.info("syncmaster appears ok, pid %s" % pid)
- return 0
-
-
- def close(self):
- """
- Closes all handles to the logs we're watching.
- """
- for h in self.handles.values():
- h.close()
- self.handles = {}
-
-
-
-if __name__ == '__main__':
-
- # setup gpAdminLogs logging
- execname = os.path.split(sys.argv[0])[-1]
- hostname = unix.getLocalHostname()
- username = unix.getUserName()
- setup_tool_logging(execname, hostname, username)
- logger = get_default_logger()
-
- # watch syncmaster logs
- watcher = SyncmasterWatcher( sys.argv[1] )
- rc = watcher.monitor_logs()
- watcher.close()
-
- # report final status
- logger.info("exiting with %s" % rc)
- sys.exit( rc )
[2/3] incubator-hawq git commit: HAWQ-158. Remove legacy command line
tools and help.
Posted by rl...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/doc/gp_dump_help
----------------------------------------------------------------------
diff --git a/tools/doc/gp_dump_help b/tools/doc/gp_dump_help
deleted file mode 100755
index d622ffc..0000000
--- a/tools/doc/gp_dump_help
+++ /dev/null
@@ -1,316 +0,0 @@
-COMMAND NAME: gp_dump
-
-Writes out a Greenplum database to SQL script files, which can
-then be used to restore the database using gp_restore.
-
-*****************************************************
-SYNOPSIS
-*****************************************************
-
-gp_dump [-a | -s] [-c] [-d] [-D] [-n <schema>] [-o] [-O]
-[-t <table_name>] [-T table_name]
-[-x] [-h <hostname>]
-[-p <port>] [-U <username>] [-W] [-i] [-v]
-[--gp-c] [--gp-d=<backup_directory>]
-[--gp-r=<reportfile>] [--gp-s=<dbid>] <database_name>
-
-gp_dump -? | --help
-
-gp_dump --version
-
-
-*****************************************************
-DESCRIPTION
-*****************************************************
-
-The gp_dump utility dumps the contents of a Greenplum database
-into SQL script files, which can then be used to restore the database
-schema and user data at a later time using gp_restore. During a dump
-operation, users will still have full access to the database.
-The functionality of gp_dump is analogous to PostgreSQLs pg_dump utility,
-which writes out (or dumps) the content of a database into a script file.
-The script file contains SQL commands that can be used to restore the
-databases, data, and global objects such as users, groups, and access
-permissions.
-
-The functionality of gp_dump is modified to accommodate the
-distributed nature of a Greenplum database. Keep in mind that a database
-in Greenplum Database is actually comprised of several PostgreSQL instances
-(the master and all segments), each of which must be dumped individually.
-The gp_dump utility takes care of dumping all of the individual instances
-across the system.
-
-The gp_dump utility performs the following actions and produces the
-following dump files by default:
-
-ON THE MASTER HOST
-
-* Dumps CREATE DATABASE SQL statements into a file in the master data
- directory. The default naming convention of this file is
- gp_cdatabase_1_<dbid>_<timestamp>. This can be run on
- the master instance to recreate the user database(s).
-
-* Dumps the user database schema(s) into a SQL file in the master
- data directory. The default naming convention of this file is
- gp_dump_1_<dbid>_<timestamp>. This file is used by gp_restore
- to recreate the database schema(s).
-
-* Creates a dump file in the master data directory named
- gp_dump_1_<dbid>_<timestamp>_post_data that contains commands to
- rebuild objects associated with the tables.
- When the database is restored with gp_restore, first the schema
- and data are restored, then the dump file is used to rebuilt
- the other objects associated with the tables.
-
-* Creates a log file in the master data directory named
- gp_dump_status_1_<dbid>_<timestamp>.
-
-* gp_dump launches a gp_dump_agent for each segment instance to be
- backed up. gp_dump_agent processes run on the segment hosts and report
- status back to the gp_dump process running on the master host.
-
-
-ON THE SEGMENT HOSTS
-
-* Dumps the user data for each segment instance into a SQL file in the segment
- instances data directory. By default, only primary (or active) segment
- instances are backed up. The default naming convention of this file is
- gp_dump_0_<dbid>_<timestamp>. This file is used by gp_restore to recreate
- that particular segment of user data.
-
-* Creates a log file in each segment instances data directory named
- gp_dump_status_0_<dbid>_<timestamp>.
-
-Note that the 14 digit timestamp is the number that uniquely identifies the
-backup job, and is part of the filename for each dump file created by a
-gp_dump operation. This timestamp must be passed to the gp_restore utility
-when restoring a Greenplum database.
-
-*****************************************************
-OPTIONS
-*****************************************************
-
--a
---data-only
-
-
-Dump only the data, not the schema (data definitions).
-
-
--s
---schema-only
-
-Dump only the object definitions (schema), not data.
-
-
--c
---clean
-
-Output commands to clean (drop) database objects prior to (the commands for)
-creating them.
-
-
--d
---inserts
-
-Dump data as INSERT commands (rather than COPY). This will make restoration
-very slow; it is mainly useful for making dumps that can be loaded into
-non-PostgreSQL based databases. Note that the restore may fail altogether
-if you have rearranged column order. The -D option is safer, though slower.
-
-
--D
---column-inserts
-
-Dump data as INSERT commands with explicit column names
-(INSERT INTO table (column, ...) VALUES ...). This will make restoration
-very slow; it is mainly useful for making dumps that can be loaded into
-non-PostgreSQL based databases.
-
-
--n <schema>
---schema=<schema>
-
-Dumps the contents of the named schema only. If this option is not
-specified, all non-system schemas in the target database will be dumped.
-Caution: In this mode, gp_dump makes no attempt to dump any other
-database objects that objects in the selected schema may depend upon.
-Therefore, there is no guarantee that the results of a single-schema
-dump can be successfully restored by themselves into a clean database.
-You cannot backup system catalog schemas (such as pg_catalog) with gp_dump.
-
-
--o
---oids
-
-Dump object identifiers (OIDs) as part of the data for every table.
-Use of OIDs is not recommended in Greenplum, so this option should
-not be used if restoring data to another Greenplum Database installation.
-
-
--O
---no-owner
-
-Do not output commands to set ownership of objects to match the
-original database. By default, gp_dump issues ALTER OWNER or
-SET SESSION AUTHORIZATION statements to set ownership of created
-database objects. These statements will fail when the script is
-run unless it is started by a superuser (or the same user that
-owns all of the objects in the script). To make a script that can
-be restored by any user, but will give that user ownership of all
-the objects, specify -O.
-
-
--t table | --table=table
-
-Dump only tables (or views or sequences) matching the table pattern.
-Multiple tables can be selected by writing multiple -t switches.
-Also, the table parameter is interpreted as a pattern according to the
-same rules used by psql�s \d commands, so multiple tables can also be
-selected by writing wildcard characters in the pattern. When using
-wildcards, be careful to quote the pattern if needed to prevent the
-shell from expanding the wildcards. The -n and -N switches have no
-effect when -t is used, because tables selected by -t will be dumped
-regardless of those switches, and non-table objects will not be dumped.
-
-Note: When -t is specified, pg_dump makes no attempt to dump any other
-database objects that the selected table(s) may depend upon.
-Therefore, there is no guarantee that the results of a specific-table
-dump can be successfully restored by themselves into a clean database.
-
-Note: -t cannot be used to specify a child table partition. To dump a
-partitioned table, you must specify the parent table name.
-
-
--T table | --exclude-table=table
-
-Do not dump any tables matching the table pattern. The pattern is
-interpreted according to the same rules as for -t. -T can be given
-more than once to exclude tables matching any of several patterns.
-When both -t and -T are given, the behavior is to dump just the tables
-that match at least one -t switch but no -T switches. If -T appears
-without -t, then tables matching -T are excluded from what is otherwise
-a normal dump.
-
-
--x
---no-privileges
---no-acl
-
-Prevents the dumping of access privileges (GRANT/REVOKE commands).
-
-
--h <hostname>
---host=<hostname>
-
-The host name of the master host. If not provided, the value of
-$PGHOST or the local host is used.
-
-
--p <port>
---port=<port>
-
-The master port. If not provided, the value of $PGPORT or the
-port number provided at compile time is used.
-
-
--U <username>
---username=<user>
-
-The database super user account name, for example bgadmin.
-If not provided, the value of $PGUSER or the current OS
-user name is used.
-
-
--W
-Forces a password prompt. This will happen automatically if
-the server requires password authentication.
-
-
--i
---ignore-version
-
-Ignores a version mismatch between gp_dump and the database server.
-
-
--v
---verbose
-
-
-Specifies verbose mode. This will cause gp_dump to output detailed
-object comments and start/stop times to the dump file, and progress
-messages to standard error.
-
-
---gp-c
-
-Use gzip for inline compression.
-
-
---gp-d=<directoryname>
-
-Specifies the relative or absolute path where the backup files
-will be placed on each host. If this is a relative path, it is
-considered to be relative to the data directory. If the path does
-not exist, it will be created, if possible. If not specified,
-defaults to the data directory of each instance to be backed up.
-Using this option may be desirable if each segment host has multiple
-segment instances it will create the dump files in a centralized location.
-
-
---gp-r=<reportfile>
-
-Specifies the full path name where the backup job report file will be
-placed on the master host. If not specified, defaults to the master
-data directory or the current directory if running remotely.
-
-
---gp-s=<dbid> (backup certain segments)
-
-Specifies the set of active segment instances to back up with a
-comma-separated list of the segments dbid. The default is to
-backup all active segment instances.
-
-
-<database_name>
-
-Required. The name of the database you want to dump. If not specified,
-the value of $PGDATABASE will be used. The database name must be
-stated last after all other options have been specified.
-
-
--? | --help
-
-Displays the online help.
-
-
---version
-
-Displays the version of this script.
-
-
-*****************************************************
-EXAMPLES
-*****************************************************
-
-Back up a database:
-
-gp_dump gpdb
-
-
-Back up a database, and create dump files in a centralized
-location on all hosts:
-
-gp_dump --gp-d=/home/gpadmin/backups gpdb
-
-
-Back up the specified schema only:
-
-gp_dump -n myschema mydatabase
-
-
-*****************************************************
-SEE ALSO
-*****************************************************
-
-gp_restore, gprebuildsystem, gprebuildseg
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/doc/gp_restore_help
----------------------------------------------------------------------
diff --git a/tools/doc/gp_restore_help b/tools/doc/gp_restore_help
deleted file mode 100755
index 2081d09..0000000
--- a/tools/doc/gp_restore_help
+++ /dev/null
@@ -1,218 +0,0 @@
-COMMAND NAME: gp_restore
-
-Restores Greenplum Database databases that were backed up using gp_dump.
-
-*****************************************************
-SYNOPSIS
-*****************************************************
-
-gp_restore --gp-k=<timestamp_key> -d <database_name> [-a | -s] [-i]
-[-v] [-c] [-h <hostname>] [-p <port>] [-U <username>] [-W]
-[--gp-c] [--gp-i] [--gp-d=<directoryname>] [--gp-r=<reportfile>]
-[--gp-l=a|p]
-
-gp_restore -? | -h | --help
-
-gp_restore --version
-
-
-*****************************************************
-DESCRIPTION
-*****************************************************
-
-
-The gp_restore utility recreates the data definitions (schema) and
-user data in a Greenplum Database database using the script files created
-by an gp_dump operation. The use of this script assumes:
-
-1. You have backup files created by an gp_dump operation.
-
-2. Your Greenplum Database system up and running.
-
-3. Your Greenplum Database system has the exact same number of segment
- instances as the system that was backed up using gp_dump.
-
-4. (optional) The gp_restore script uses the information in
- the Greenplum system catalog tables to determine the hosts, ports,
- and data directories for the segment instances it is restoring. If
- you want to change any of this information (for example, move the
- system to a different array of hosts) you must use the gprebuildsystem
- and gprebuildseg scripts to reconfigure your array before restoring.
-
-5. The databases you are restoring have been created in the system.
-
-The functionality of gp_restore is analogous to PostgreSQL pg_restore
-utility, which restores a database from files created by the database
-backup process. It issues the commands necessary to reconstruct the database
-to the state it was in at the time it was saved.
-
-The functionality of gp_restore is modified to accommodate the
-distributed nature of a Greenplum Database database, and to use files
-created by an gp_dump operation. Keep in mind that a database in
-Greenplum is actually comprised of several PostgreSQL instances (the master
-and all segments), each of which must be restored individually.
-The gp_restore utility takes care of populating each segment in the
-system with its own distinct portion of data.
-
-The gp_restore utility performs the following actions:
-
-ON THE MASTER HOST
-
-* Creates the user database schema(s) using the
- gp_dump_1_<dbid>_<timestamp> SQL file created by gp_dump.
-
-* Creates a log file in the master data directory named
- gp_restore_status_1_<dbid>_<timestamp>.
-
-* gp_restore launches a gp_restore_agent for each segment instance
- to be restored. gp_restore_agent processes run on the segment hosts
- and report status back to the gp_restore process running on the
- master host.
-
-ON THE SEGMENT HOSTS
-
-* Restores the user data for each segment instance using the
- gp_dump_0_<dbid>_<timestamp> files created by gp_dump. Each
- segment instance on a host (primary and mirror instances) are restored.
-
-* Creates a log file for each segment instance named
- gp_restore_status_0_<dbid>_<timestamp>.
-
-Note that the 14 digit timestamp is the number that uniquely identifies
-the backup job to be restored, and is part of the filename for each
-dump file created by a gp_dump operation. This timestamp must be passed
-to the gp_restore utility when restoring a Greenplum Database database.
-
-
-
-*****************************************************
-OPTIONS
-*****************************************************
-
-
---gp-k=<timestamp_key>
-
-Required. The 14 digit timestamp key that uniquely identifies the
-backup set of data to restore. This timestamp can be found in the gp_dump
-log file output, as well as at the end of the dump files created by a
-gp_dump operation. It is of the form YYYYMMDDHHMMSS.
-
-
--d <database_name>
---dbname=<dbname>
-
-Required. The name of the database to connect to in order to restore
-the user data. The database(s) you are restoring must exist, gp_restore
-does not create the database.
-
-
--i
---ignore-version
-
-Ignores a version mismatch between gp_restore and the database server.
-
-
--v
---verbose
-
-Specifies verbose mode.
-
-
--a
---data-only
-
-Restore only the data, not the schema (data definitions).
-
-
--c
---clean
-
-Clean (drop) database objects before recreating them.
-
-
--s
---schema-only
-
-Restores only the schema (data definitions), no user data is restored.
-
-
--h <hostname>
---host=<hostname>
-
-The host name of the master host. If not provided, the value of PGHOST
-or the local host is used.
-
-
--p <port>
---port=<port>
-
-The master port. If not provided, the value of PGPORT or
-the port number provided at compile time is used.
-
-
--U <username>
---username=<username>
-
-The database super user account name, for example bgadmin. If not
-provided, the value of PGUSER or the current OS user name is used.
-
-
--W
-
-Forces a password prompt. This will happen automatically if the
-server requires password authentication.
-
-
---gp-c
-
-Use gunzip for inline decompression.
-
-
---gp-i
-
-Specifies that processing should ignore any errors that occur. Use
-this option to continue restore processing on errors.
-
-
---gp-d=<directoryname>
-
-Specifies the relative or absolute path to backup files on the hosts.
-If this is a relative path, it is considered to be relative to the data
-directory. If not specified, defaults to the data directory of each instance
-being restored. Use this option if you created your backup files in an
-alternate location when running gp_dump.
-
-
---gp-r=<reportfile>
-
-Specifies the full path name where the restore job report file will
-be placed on the master host. If not specified, defaults to the
-master data directory.
-
-
---gp-l={a|p}
-
-Specifies whether to check for backup files on (a)ll segment instances
-or only on (p)rimary segment instances. The default is to check for
-primary segment backup files only, and then recreate the corresponding
-mirrors.
-
-
-*****************************************************
-EXAMPLES
-*****************************************************
-
-
-Restore a Greenplum database using backup files created by gp_dump:
-
-gp_restore --gp-k=2005103112453 -d gpdb
-
-
-*****************************************************
-SEE ALSO
-*****************************************************
-
-
-gp_dump, gprebuildsystem, gprebuildseg
-
-
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/doc/gpaddmirrors_help
----------------------------------------------------------------------
diff --git a/tools/doc/gpaddmirrors_help b/tools/doc/gpaddmirrors_help
deleted file mode 100755
index 5ee2089..0000000
--- a/tools/doc/gpaddmirrors_help
+++ /dev/null
@@ -1,253 +0,0 @@
-COMMAND NAME: gpaddmirrors
-
-Adds mirror segments to a Greenplum Database system that was
-initially configured without mirroring.
-
-
-*****************************************************
-SYNOPSIS
-*****************************************************
-
-
-gpaddmirrors [-p <port_offset>] [-m <datadir_config_file> [-a]] [-s]
- [-d <master_data_directory>] [-B <parallel_processes>]
- [-l <logfile_directory>] [-v]
-
-gpaddmirrors -i <mirror_config_file> [-s] [-a]
- [-d <master_data_directory>] [-B <parallel_processes>]
- [-l <logfile_directory>] [-v]
-
-gpaddmirrors -o <output_sample_mirror_config> [-m <datadir_config_file>]
-
-gpaddmirrors -?
-
-gpaddmirrors --version
-
-
-*****************************************************
-DESCRIPTION
-*****************************************************
-The gpaddmirrors utility configures mirror segment instances for an
-existing Greenplum Database system that was initially configured with
-primary segment instances only. The utility will create the mirror
-instances and begin the online replication process between the primary
-and mirror segment instances. Once all mirrors are synchronized with
-their primaries, your Greenplum Database system is fully data redundant.
-
-By default, the utility will prompt you for the file system location(s)
-where it will create the mirror segment data directories. If you do not
-want to be prompted, you can pass in a file containing the file system
-locations using the -m option.
-
-The mirror locations and ports must be different than your primary
-segment data locations and ports. If you have created additional filespaces,
-you will also be prompted for mirror locations for each of your filespaces.
-
-The utility will create a unique data directory for each mirror segment
-instance in the specified location using the predefined naming convention.
-There must be the same number of file system locations declared for mirror
-segment instances as for primary segment instances. It is OK to specify
-the same directory name multiple times if you want your mirror data
-directories created in the same location, or you can enter a different
-data location for each mirror. Enter the absolute path. For example:
-
-Enter mirror segment data directory location 1 of 2 > /gpdb/mirror
-Enter mirror segment data directory location 2 of 2 > /gpdb/mirror
-OR
-Enter mirror segment data directory location 1 of 2 > /gpdb/m1
-Enter mirror segment data directory location 2 of 2 > /gpdb/m2
-
-Alternatively, you can run the gpaddmirrors utility and supply a
-detailed configuration file using the -i option. This is useful if
-you want your mirror segments on a completely different set of hosts
-than your primary segments. The format of the mirror configuration file is:
-
-filespaceOrder=[<filespace1_fsname>[:<filespace2_fsname>:...]
-mirror<content>=<content>:<address>:<port>:<mir_replication_port>:<pri_replication_port>:<fselocation>[:<fselocation>:...]
-
-For example (if you do not have additional filespaces configured
-besides the default pg_system filespace):
-
-filespaceOrder=
-mirror0=0:sdw1-1:60000:61000:62000:/gpdata/mir1/gp0
-mirror1=1:sdw1-1:60001:61001:62001:/gpdata/mir2/gp1
-
-The gp_segment_configuration, pg_filespace, and pg_filespace_entry
-system catalog tables can help you determine your current primary
-segment configuration so that you can plan your mirror segment
-configuration. For example, run the following query:
-
-=# SELECT dbid, content, address as host_address, port,
- replication_port, fselocation as datadir
- FROM gp_segment_configuration, pg_filespace_entry
- WHERE dbid=fsedbid
- ORDER BY dbid;
-
-If creating your mirrors on alternate mirror hosts, the new
-mirror segment hosts must be pre-installed with the Greenplum
-Database software and configured exactly the same as the
-existing primary segment hosts.
-
-You must make sure that the user who runs gpaddmirrors (the
-gpadmin user) has permissions to write to the data directory
-locations specified. You may want to create these directories
-on the segment hosts and chown them to the appropriate user
-before running gpaddmirrors.
-
-
-*****************************************************
-OPTIONS
-*****************************************************
-
--a (do not prompt)
-
- Run in quiet mode - do not prompt for information. Must supply
- a configuration file with either -m or -i if this option is used.
-
-
--B <parallel_processes>
-
- The number of mirror setup processes to start in parallel. If
- not specified, the utility will start up to 10 parallel processes
- depending on how many mirror segment instances it needs to set up.
-
-
--d <master_data_directory>
-
- The master data directory. If not specified, the value set for
- $MASTER_DATA_DIRECTORY will be used.
-
-
--i <mirror_config_file>
-
- A configuration file containing one line for each mirror segment
- you want to create. You must have one mirror segment listed for
- each primary segment in the system. The format of this file is as
- follows (as per attributes in the gp_segment_configuration,
- pg_filespace, and pg_filespace_entry catalog tables):
-
- filespaceOrder=[<filespace1_fsname>[:<filespace2_fsname>:...]
- mirror<content>=<content>:<address>:<port>:<mir_replication_port>:<pri_replication_port>:<fselocation>[:<fselocation>:...]
-
- Note that you only need to specify a name for filespaceOrder if
- your system has multiple filespaces configured. If your system does
- not have additional filespaces configured besides the default pg_system
- filespace, this file will only have one location per segment (for
- the default data directory filespace, pg_system). pg_system does
- not need to be listed in the filespaceOrder line. It will always be
- the first <fselocation> listed after <replication_port>.
-
-
--l <logfile_directory>
-
- The directory to write the log file. Defaults to ~/gpAdminLogs.
-
-
--m <datadir_config_file>
-
- A configuration file containing a list of file system locations where
- the mirror data directories will be created. If not supplied, the
- utility will prompt you for locations. Each line in the file specifies
- a mirror data directory location. For example:
- /gpdata/m1
- /gpdata/m2
- /gpdata/m3
- /gpdata/m4
- If your system has additional filespaces configured in addition to the
- default pg_system filespace, you must also list file system locations
- for each filespace as follows:
- filespace filespace1
- /gpfs1/m1
- /gpfs1/m2
- /gpfs1/m3
- /gpfs1/m4
-
-
--o <output_sample_mirror_config>
-
- If you are not sure how to lay out the mirror configuration file
- used by the -i option, you can run gpaddmirrors with this option
- to generate a sample mirror configuration file based on your
- primary segment configuration. The utility will prompt you for
- your mirror segment data directory locations (unless you provide
- these in a file using -m). You can then edit this file to change
- the host names to alternate mirror hosts if necessary.
-
-
--p <port_offset>
-
- Optional. This number is used to calculate the database ports
- and replication ports used for mirror segments. The default offset
- is 1000. Mirror port assignments are calculated as follows:
- primary port + offset = mirror database port
- primary port + (2 * offset) = mirror replication port
- primary port + (3 * offset) = primary replication port
- For example, if a primary segment has port 50001, then its mirror
- will use a database port of 51001, a mirror replication port of
- 52001, and a primary replication port of 53001 by default.
-
-
--s (spread mirrors)
-
- Spreads the mirror segments across the available hosts. The
- default is to group a set of mirror segments together on an
- alternate host from their primary segment set. Mirror spreading
- will place each mirror on a different host within the Greenplum
- Database array. Spreading is only allowed if there is a sufficient
- number of hosts in the array (number of hosts is greater than
- or equal to the number of segment instances per host).
-
-
--v (verbose)
-
- Sets logging output to verbose.
-
-
---version (show utility version)
-
- Displays the version of this utility.
-
-
--? (help)
-
- Displays the online help.
-
-
-*****************************************************
-EXAMPLES
-*****************************************************
-
-Add mirroring to an existing Greenplum Database system using
-the same set of hosts as your primary data. Calculate the mirror
-database and replication ports by adding 100 to the current
-primary segment port numbers:
-
- $ gpaddmirrors -p 100
-
-
-Add mirroring to an existing Greenplum Database system using a
-different set of hosts from your primary data:
-
-$ gpaddmirrors -i mirror_config_file
-
-Where the mirror_config_file looks something like this (if you do not
-have additional filespaces configured besides the default pg_system
-filespace):
-
-filespaceOrder=
-mirror0=0:sdw1-1:52001:53001:54001:/gpdata/mir1/gp0
-mirror1=1:sdw1-2:52002:53002:54002:/gpdata/mir2/gp1
-mirror2=2:sdw2-1:52001:53001:54001:/gpdata/mir1/gp2
-mirror3=3:sdw2-2:52002:53002:54002:/gpdata/mir2/gp3
-
-
-Output a sample mirror configuration file to use with gpaddmirrors -i:
-
- $ gpaddmirrors -o /home/gpadmin/sample_mirror_config
-
-
-*****************************************************
-SEE ALSO
-*****************************************************
-
-gpinitsystem, gpinitstandby, gpactivatestandby
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/doc/gpbitmapreindex_help
----------------------------------------------------------------------
diff --git a/tools/doc/gpbitmapreindex_help b/tools/doc/gpbitmapreindex_help
deleted file mode 100644
index c81311e..0000000
--- a/tools/doc/gpbitmapreindex_help
+++ /dev/null
@@ -1,111 +0,0 @@
-COMMAND NAME: gpbitmapreindex
-
-Rebuilds bitmap indexes after a 3.3.x to 4.0.x upgrade.
-
-
-*****************************************************
-SYNOPSIS
-*****************************************************
-
-gpbitmapreindex -m { r | d | {l [-o <output_sql_file>]} }
- [-h <master_host>] [-p <master_port>]
- [-n <number_of_processes>] [-v]
-
-gpmigrator --version
-
-gpmigrator --help | -?
-
-
-*****************************************************
-DESCRIPTION
-*****************************************************
-
-The on-disk format of bitmap indexes has changed from release
-3.3.x to 4.0.x. Users who upgrade must rebuild all bitmap indexes
-after upgrading to 4.0. The gpbitmapreindex utility facilitates the
-upgrade of bitmap indexes by either running the REINDEX command to
-reindex them, or running the DROP INDEX command to simply remove them.
-If you decide to drop your bitmap indexes rather than reindex,
-run gpbitmapreindex in list --outfile mode first to output a SQL file
-that you can use to recreate the indexes later. You must be the
-Greenplum Database superuser (gpadmin) in order to run gpbitmapreindex.
-
-
-*****************************************************
-OPTIONS
-*****************************************************
-
--h <host> | --host <host>
-
-Specifies the host name of the machine on which the Greenplum
-master database server is running. If not specified, reads from
-the environment variable PGHOST or defaults to localhost.
-
-
--m {r|d|l} | --mode {reindex|drop|list}
-
-Required. The bitmap index upgrade mode: either reindex, drop,
-or list all bitmap indexes in the system.
-
-
--n <number_of_processes> | --parallel <number_of_processes>
-
-The number of bitmap indexes to reindex or drop in parallel.
-Valid values are 1-16. The default is 1.
-
-
--o <output_sql_file> | --outfile <output_sql_file>
-
-When used with list mode, outputs a SQL file that can be
-used to recreate the bitmap indexes.
-
-
--p <port> | --port <port>
-
-Specifies the TCP port on which the Greenplum master database
-server is listening for connections. If not specified, reads from
-the environment variable PGPORT or defaults to 5432.
-
-
--v | --verbose
-
-Show verbose output.
-
-
---version
-
-Displays the version of this utility.
-
-
--? | --help
-
-Displays the online help.
-
-
-*****************************************************
-EXAMPLES
-*****************************************************
-
-Reindex all bitmap indexes:
-
- gpbitmapreindex -m r
-
-
-Output a file of SQL commands that can be used to recreate all
-bitmap indexes:
-
- gpbitmapreindex -m list --outfile /home/gpadmin/bmp_ix.sql
-
-
-Drop all bitmap indexes and run in verbose mode:
-
- gpbitmapreindex -m d -v
-
-
-*****************************************************
-SEE ALSO
-*****************************************************
-
-REINDEX, DROP INDEX, CREATE INDEX
-
-
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/doc/gpcheckos.xml
----------------------------------------------------------------------
diff --git a/tools/doc/gpcheckos.xml b/tools/doc/gpcheckos.xml
deleted file mode 100644
index ecdd752..0000000
--- a/tools/doc/gpcheckos.xml
+++ /dev/null
@@ -1,91 +0,0 @@
-<?xml version="1.0"?>
-<gpcheckosxml>
-<osParm>
- <sysctlConf>
- <param>net.ipv4.ip_forward</param>
- <value>0</value>
- </sysctlConf>
- <sysctlConf>
- <param>net.ipv4.tcp_tw_recycle</param>
- <value>1</value>
- </sysctlConf>
- <sysctlConf>
- <param>kernel.sem</param>
- <value>250 64000 100 512</value>
- </sysctlConf>
- <sysctlConf>
- <param>kernel.shmall</param>
- <value>4000000000</value>
- </sysctlConf>
- <sysctlConf>
- <param>kernel.shmmni</param>
- <value>4096</value>
- </sysctlConf>
- <sysctlConf>
- <param>kernel.shmmax</param>
- <value>500000000</value>
- </sysctlConf>
- <sysctlConf>
- <param>kernel.msgmax</param>
- <value>65536</value>
- </sysctlConf>
- <sysctlConf>
- <param>kernel.msgmnb</param>
- <value>65536</value>
- </sysctlConf>
- <sysctlConf>
- <param>net.ipv4.tcp_syncookies</param>
- <value>1</value>
- </sysctlConf>
- <sysctlConf>
- <param>kernel.core_uses_pid</param>
- <value>1</value>
- </sysctlConf>
- <sysctlConf>
- <param>net.ipv4.conf.default.accept_source_route</param>
- <value>0</value>
- </sysctlConf>
- <param>net.ipv4.tcp_max_syn_backlog</param>
- <value>1</value>
- <sysctlConf>
- <param>net.core.netdev_max_backlog</param>
- <value>10000</value>
- </sysctlConf>
- <sysctlConf>
- <param>vm.overcommit_memory</param>
- <value>2</value>
- </sysctlConf>
- <sysctlConf>
- <param>kernel.sysrq</param>
- <value>0</value>
- </sysctlConf>
- <limitsConf>
- <limit>nofile</limit>
- <softValue>* soft nofile 65536</softValue>
- <hardValue>* hard nofile 65536</hardValue>
- </limitsConf>
- <limitsConf>
- <limit>nproc</limit>
- <softValue>* soft nproc 131072</softValue>
- <hardValue>* hard nproc 131072</hardValue>
- </limitsConf>
- <blockDev>
- <target>/dev/sd?</target>
- <operation>setra</operation>
- <opValue>16384</opValue>
- </blockDev>
- <grub>
- <appendValue>elevator=deadline</appendValue>
- </grub>
-
-</osParm>
-<refPlatform>
- <Dell>
- <model>PowerEdge R710</model>
- </Dell>
- <hp>
- <model>ProLiant DL185</model>
- <ctrlUtil>/usr/sbin/hpacucli</ctrlUtil>
- </hp>
-</refPlatform>
-</gpcheckosxml>
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/doc/gpcheckos_help
----------------------------------------------------------------------
diff --git a/tools/doc/gpcheckos_help b/tools/doc/gpcheckos_help
deleted file mode 100755
index 039c474..0000000
--- a/tools/doc/gpcheckos_help
+++ /dev/null
@@ -1,3 +0,0 @@
-COMMAND NAME: gpcheckos
-
-THIS UTILITY IS DEPRECATED - USE gpcheck INSTEAD.
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/doc/gpcrondump_help
----------------------------------------------------------------------
diff --git a/tools/doc/gpcrondump_help b/tools/doc/gpcrondump_help
deleted file mode 100755
index f3bf009..0000000
--- a/tools/doc/gpcrondump_help
+++ /dev/null
@@ -1,330 +0,0 @@
-COMMAND NAME: gpcrondump
-
-A wrapper utility for gp_dump, which can be called directly or
-from a crontab entry.
-
-*****************************************************
-SYNOPSIS
-*****************************************************
-
-gpcrondump -x <database_name>
- [-s <schema> | -t <schema>.<table> | -T <schema>.<table>]
- [--table-file="<filename>" | --exclude-table-file="<filename>"]
- [-u <backup_directory>] [-R <post_dump_script>]
- [-c] [-z] [-r] [-f <free_space_percent>] [-b] [-h] [-j | -k]
- [-g] [-G] [-C] [-d <master_data_directory>] [-B <parallel_processes>]
- [-a] [-q] [-y <reportfile>] [-l <logfile_directory>] [-v]
- { [-E <encoding>] [--inserts | --column-inserts] [--oids]
- [--no-owner | --use-set-session-authorization]
- [--no-privileges] [--rsyncable]
-
-gpcrondump -o
-
-gpcrondump -?
-
-gpcrondump --version
-
-
-*****************************************************
-DESCRIPTION
-*****************************************************
-
-gpcrondump is a wrapper utility for gp_dump. By default, dump files are
-created in their respective master and segment data directories in a
-directory named db_dumps/YYYYMMDD. The data dump files are compressed
-by default using gzip.
-
-gpcrondump allows you to schedule routine backups of a Greenplum database
-using cron (a scheduling utility for UNIX operating systems). Cron jobs
-that call gpcrondump should be scheduled on the master host.
-
-gpcrondump is used to schedule Data Domain Boost backup and restore
-operations. gpcrondump is also used to set or remove one-time
-credentials for Data Domain Boost.
-
-**********************
-Return Codes
-**********************
-
-The following is a list of the codes that gpcrondump returns.
- 0 - Dump completed with no problems
- 1 - Dump completed, but one or more warnings were generated
- 2 - Dump failed with a fatal error
-
-**********************
-EMAIL NOTIFICATIONS
-**********************
-To have gpcrondump send out status email notifications, you must place
-a file named mail_contacts in the home directory of the Greenplum
-superuser (gpadmin) or in the same directory as the gpcrondump utility
-($GPHOME/bin). This file should contain one email address per line.
-gpcrondump will issue a warning if it cannot locate a mail_contacts file
-in either location. If both locations have a mail_contacts file, then
-the one in $HOME takes precedence.
-
-
-*****************************************************
-OPTIONS
-*****************************************************
-
--a (do not prompt)
-
- Do not prompt the user for confirmation.
-
-
--b (bypass disk space check)
-
- Bypass disk space check. The default is to check for available disk space.
-
- Note: Bypassing the disk space check generates a warning message.
- With a warning message, the return code for gpcrondump is 1 if the
- dump is successful. (If the dump fails, the return code is 2, in all cases.)
-
-
--B <parallel_processes>
-
- The number of segments to check in parallel for pre/post-dump validation.
- If not specified, the utility will start up to 60 parallel processes
- depending on how many segment instances it needs to dump.
-
-
--c (clear old dump files first)
-
- Clear out old dump files before doing the dump. The default is not to
- clear out old dump files. This will remove all old dump directories in
- the db_dumps directory, except for the dump directory of the current date.
-
-
--C (clean old catalog dumps)
-
- Clean out old catalog schema dump files prior to create.
-
-
---column-inserts
-
- Dump data as INSERT commands with column names.
-
-
--d <master_data_directory>
-
- The master host data directory. If not specified, the value
- set for $MASTER_DATA_DIRECTORY will be used.
-
--E encoding
-
- Character set encoding of dumped data. Defaults to the encoding of
- the database being dumped.
-
-
--f <free_space_percent>
-
- When doing the check to ensure that there is enough free disk space to
- create the dump files, specifies a percentage of free disk space that
- should remain after the dump completes. The default is 10 percent.
-
--g (copy config files)
-
- Secure a copy of the master and segment configuration files
- postgresql.conf, pg_ident.conf, and pg_hba.conf. These
- configuration files are dumped in the master or segment data
- directory to db_dumps/YYYYMMDD/config_files_<timestamp>.tar
-
--G (dump global objects)
-
- Use pg_dumpall to dump global objects such as roles and tablespaces.
- Global objects are dumped in the master data directory to
- db_dumps/YYYYMMDD/gp_global_1_1_<timestamp>.
-
--h (record dump details)
-
- Record details of database dump in database table
- public.gpcrondump_history in database supplied via
- -x option. Utility will create table if it does not
- currently exist.
-
-
---inserts
-
- Dump data as INSERT, rather than COPY commands.
-
-
--j (vacuum before dump)
-
- Run VACUUM before the dump starts.
-
-
--k (vacuum after dump)
-
- Run VACUUM after the dump has completed successfully.
-
-
--l <logfile_directory>
-
- The directory to write the log file. Defaults to ~/gpAdminLogs.
-
-
---no-owner
-
- Do not output commands to set object ownership.
-
-
---no-privileges
-
- Do not output commands to set object privileges (GRANT/REVOKE commands).
-
-
--o (clear old dump files only)
-
- Clear out old dump files only, but do not run a dump. This will remove
- the oldest dump directory except the current date's dump directory.
- All dump sets within that directory will be removed.
-
-
---oids
-
- Include object identifiers (oid) in dump data.
-
-
--q (no screen output)
-
- Run in quiet mode. Command output is not displayed on the screen,
- but is still written to the log file.
-
-
--r (rollback on failure)
-
- Rollback the dump files (delete a partial dump) if a failure
- is detected. The default is to not rollback.
-
-
--R <post_dump_script>
-
- The absolute path of a script to run after a successful dump operation.
- For example, you might want a script that moves completed dump files
- to a backup host. This script must reside in the same location on
- the master and all segment hosts.
-
-
---rsyncable
-
- Passes the --rsyncable flag to the gpzip utility to synchronize
- the output occasionally, based on the input during compression.
- This synchronization increases the file size by less than 1% in
- most cases. When this flag is passed, the rsync(1) program can
- synchronize compressed files much more efficiently. The gunzip
- utility cannot differentiate between a compressed file created
- with this option, and one created without it.
-
-
--s <schema_name>
-
- Dump only the named schema in the named database.
-
-
--t <schema>.<table_name>
-
- Dump only the named table in this database.
- The -t option can be specified multiple times.
-
-
--T <schema>.<table_name>
-
- A table name to exclude from the database dump.
- The -T option can be specified multiple times.
-
---exclude-table-file="<filename>"
-
- Exclude all tables listed in <filename> from the
- database dump. The file <filename> contains any
- number of tables, listed one per line.
-
---table-file="<filename>"
-
- Dump only the tables listed in <filename>.
- The file <filename> contains any
- number of tables, listed one per line.
-
--u <backup_directory>
-
- Specifies the absolute path where the backup files will be
- placed on each host. If the path does not exist, it will be
- created, if possible. If not specified, defaults to the data
- directory of each instance to be backed up. Using this option
- may be desirable if each segment host has multiple segment
- instances as it will create the dump files in a centralized
- location rather than the segment data directories.
-
-
---use-set-session-authorization
-
- Use SET SESSION AUTHORIZATION commands instead of ALTER OWNER
- commands to set object ownership.
-
-
--v | --verbose
-
- Specifies verbose mode.
-
-
---version (show utility version)
-
- Displays the version of this utility.
-
-
--x <database_name>
-
- Required. The name of the Greenplum database to dump.
- Multiple databases can be specified in a comma-separated list.
-
-
--y <reportfile>
-
- Specifies the full path name where the backup job log file will
- be placed on the master host. If not specified, defaults to the
- master data directory or if running remotely, the current working
- directory.
-
-
--z (no compression)
-
- Do not use compression. Default is to compress the dump files
- using gzip.
-
- We recommend using this option for NFS and Data Dommain
- Boost backups.
-
-
--? (help)
-
- Displays the online help.
-
-
-*****************************************************
-EXAMPLES
-*****************************************************
-
-Call gpcrondump directly and dump mydatabase (and global objects):
-
- gpcrondump -x mydatabase -c -g -G
-
-A crontab entry that runs a backup of the sales database
-(and global objects) nightly at one past midnight:
-
- 01 0 * * * /home/gpadmin/gpdump.sh >> gpdump.log
-
-The content of dump script gpdump.sh is:
-
- #!/bin/bash
- export GPHOME=/usr/local/greenplum-db
- export MASTER_DATA_DIRECTORY=/data/gpdb_p1/gp-1
- . $GPHOME/greenplum_path.sh
- gpcrondump -x sales -c -g -G -a -q
-
-
-*****************************************************
-SEE ALSO
-*****************************************************
-
-gp_dump, gpdbrestore
-
-
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/doc/gpdbrestore_help
----------------------------------------------------------------------
diff --git a/tools/doc/gpdbrestore_help b/tools/doc/gpdbrestore_help
deleted file mode 100644
index 7cfd7d1..0000000
--- a/tools/doc/gpdbrestore_help
+++ /dev/null
@@ -1,203 +0,0 @@
-COMMAND NAME: gpdbrestore
-
-A wrapper utility around gp_restore. Restores a database from
-a set of dump files generated by gpcrondump.
-
-*****************************************************
-SYNOPSIS
-*****************************************************
-
-
-gpdbrestore { -t <timestamp_key> [-L]
- | -b YYYYMMDD
- | -R <hostname>:<path_to_dumpset>
- | -s <database_name> }
- [-T <schema>.<table> [,...]] [-e] [-G] [-B <parallel_processes>]
- [-d <master_data_directory>] [-a] [-q] [-l <logfile_directory>]
- [-v]
-
-gpdbrestore -?
-
-gpdbrestore --version
-
-
-*****************************************************
-DESCRIPTION
-*****************************************************
-
-gpdbrestore is a wrapper around gp_restore, which provides some
-convenience and flexibility in restoring from a set of backup
-files created by gpcrondump. This utility provides the following
-additional functionality on top of gp_restore:
-
-* Automatically reconfigures for compression.
-
-* Validates the number of dump files are correct (For primary
- only, mirror only, primary and mirror, or a subset consisting
- of some mirror and primary segment dump files).
-
-* If a failed segment is detected, restores to active segment instances.
-
-* Do not need to know the complete timestamp key (-t) of the backup
- set to restore. Additional options are provided to instead give
- just a date (-b), backup set directory location (-R), or
- database name (-s) to restore.
-
-* The -R option allows the ability to restore from a backup set
- located on a host outside of the Greenplum Database array
- (archive host). Ensures that the correct dump file goes to the
- correct segment instance.
-
-* Identifies the database name automatically from the backup set.
-
-* Allows you to restore particular tables only (-T option) instead
- of the entire database. Note that single tables are not automatically
- dropped or truncated prior to restore.
-
-* Can restore global objects such as roles and tablespaces (-G option).
-
-* Detects if the backup set is primary segments only or primary
- and mirror segments and passes the appropriate options to gp_restore.
-
-* Allows you to drop the target database before a restore in a
- single operation.
-
-Error Reporting
-
-gpdbrestore does not report errors automatically. After the restore
-is completed, check the report status files to verify that there
-are no errors. The restore status files are stored in the
-db_dumps/<date>/ directory by default.
-
-
-*****************************************************
-OPTIONS
-*****************************************************
-
--a (do not prompt)
-
- Do not prompt the user for confirmation.
-
-
--b YYYYMMDD
-
- Looks for dump files in the segment data directories on the
- Greenplum Database array of hosts in db_dumps/YYYYMMDD.
-
--B <parallel_processes>
-
- The number of segments to check in parallel for pre/post-restore
- validation. If not specified, the utility will start up to 60
- parallel processes depending on how many segment instances it
- needs to restore.
-
-
--d <master_data_directory>
-
- Optional. The master host data directory. If not specified, the
- value set for $MASTER_DATA_DIRECTORY will be used.
-
-
--e (drop target database before restore)
-
- Drops the target database before doing the restore and then recreates it.
-
-
--G (restore global objects)
-
- Restores global objects such as roles and tablespaces if the global
- object dump file db_dumps/<date>/gp_global_1_1_<timestamp> is found
- in the master data directory.
-
-
--l <logfile_directory>
-
- The directory to write the log file. Defaults to ~/gpAdminLogs.
-
-
--L (list tablenames in backup set)
-
- When used with the -t option, lists the table names that exist in
- the named backup set and exits. Does not do a restore.
-
-
--q (no screen output)
-
- Run in quiet mode. Command output is not displayed on the screen,
- but is still written to the log file.
-
-
--R <hostname>:<path_to_dumpset>
-
- Allows you to provide a hostname and full path to a set of dump
- files. The host does not have to be in the Greenplum Database array
- of hosts, but must be accessible from the Greenplum master.
-
-
--s <database_name>
-
- Looks for latest set of dump files for the given database name in
- the segment data directories db_dumps directory on the Greenplum
- Database array of hosts.
-
-
--t <timestamp_key>
-
- The 14 digit timestamp key that uniquely identifies a backup set
- of data to restore. It is of the form YYYYMMDDHHMMSS. Looks for
- dump files matching this timestamp key in the segment data
- directories db_dumps directory on the Greenplum Database array of hosts.
-
-
--T <schema>.<table_name>
-
- A comma-separated list of specific table names to restore. The
- named table(s) must exist in the backup set of the database being
- restored. Existing tables are not automatically truncated before
- data is restored from backup. If your intention is to replace
- existing data in the table from backup, truncate the table prior
- to running gpdbrestore -T.
-
-
--v | --verbose
- Specifies verbose mode.
-
-
---version (show utility version)
-
- Displays the version of this utility.
-
-
--? (help)
-
- Displays the online help.
-
-
-*****************************************************
-EXAMPLES
-*****************************************************
-
-Restore the sales database from the latest backup files generated
-by gpcrondump (assumes backup files are in the segment data
-directories in db_dumps):
-
- gpdbrestore -s sales
-
-
-Restore a database from backup files that reside on an archive
-host outside the Greenplum Database array (command issued on the
-Greenplum master host):
-
- gpdbrestore -R archivehostname:/data_p1/db_dumps/20080214
-
-
-Restore global objects only (roles and tablespaces):
-
- gpdbrestore -G
-
-
-*****************************************************
-SEE ALSO
-*****************************************************
-
-gpcrondump, gp_restore
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/doc/gpdeletesystem_help
----------------------------------------------------------------------
diff --git a/tools/doc/gpdeletesystem_help b/tools/doc/gpdeletesystem_help
deleted file mode 100755
index afb19ad..0000000
--- a/tools/doc/gpdeletesystem_help
+++ /dev/null
@@ -1,97 +0,0 @@
-COMMAND NAME: gpdeletesystem
-
-Deletes a Greenplum Database system that was initialized
-using gpinitsystem.
-
-
-*****************************************************
-SYNOPSIS
-*****************************************************
-
-gpdeletesystem -d <master_data_directory> [-B <parallel_processes>]
-[-f] [-l <logfile_directory>] [-D]
-
-gpdeletesystem -?
-
-gpdeletesystem -v
-
-
-*****************************************************
-DESCRIPTION
-*****************************************************
-
-The gpdeletesystem script will perform the following actions:
-
-* Stop all postmaster processes (the segment instances and master instance).
-
-* Delete all data directories.
-
-Before runing this script, you should move any backup files
-(created by gp_dump) out of the master and segment data directories.
-
-This script will not uninstall the Greenplum Database software.
-
-
-*****************************************************
-OPTIONS
-*****************************************************
-
--d <master_data_directory>
-
-Required. The master host data directory.
-
-
--B <parallel_processes>
-
-The number of segments to delete in parallel. If not specified, the
-script will start up to 60 parallel processes depending on how many
-segment instances it needs to delete.
-
-
--f (force)
-
-Force a delete even if backup files are found in the data directories.
-The default is to not delete Greenplum Database instances if backup
-files (created by gp_dump) are present.
-
-
--l <logfile_directory>
-
-The directory to write the log file. Defaults to ~/gpAdminLogs.
-
-
--D (debug)
-
-Sets logging level to debug.
-
-
--? (help)
-
-Displays the online help.
-
-
--v (show script version)
-
-Displays the version, status, last updated date, and check sum of this script.
-
-
-*****************************************************
-EXAMPLES
-*****************************************************
-
-Delete a Greenplum Database system:
-
-gpdeletesystem -d /gpdata/gp-1
-
-
-Delete a Greenplum Database system even if backup files are present:
-
-gpdeletesystem -d /gpdata/gp-1 -f
-
-
-*****************************************************
-SEE ALSO
-*****************************************************
-
-gpinitsystem, gp_dump
-
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/doc/gpdetective_help
----------------------------------------------------------------------
diff --git a/tools/doc/gpdetective_help b/tools/doc/gpdetective_help
deleted file mode 100644
index 2b8b2f9..0000000
--- a/tools/doc/gpdetective_help
+++ /dev/null
@@ -1,187 +0,0 @@
-COMMAND NAME: gpdetective
-
-Collects diagnostic information from a running HAWQ system.
-
-
-*****************************************************
-SYNOPSIS
-*****************************************************
-
-gpdetective [-h <hostname>] [-p <port>] [-U <username>] [-P <password>]
- [--start_date <number_of_days> | <YYYY-MM-DD>]
- [--end_date <YYYY-MM-DD>]
- [--diagnostics a|n|s|o|c]
- [--logs a|n|<dbid>[,<dbid>,... | -<dbid>]]
- [--cores t|f]
- [--pg_dumpall t|f] [--pg_dump_options <option>[,...]]
- [--tempdir <temp_dir>]
- [--connect t|f]
-
-gpdetective -?
-
-gpdetective -v
-
-
-*****************************************************
-DESCRIPTION
-*****************************************************
-
-The gpdetective utility collects information from a running HAWQ
-system and creates a bzip2-compressed tar output file. This
-output file can then be sent to Greenplum Customer Support to help with
-the diagnosis of HAWQ errors or system failures. The
-gpdetective utility runs the following diagnostic tests:
-
- * gpstate to check the system status
- * gpcheckos to verify the recommended OS settings on all hosts
- * gpcheckcat and gpcheckdb to check the system catalog tables
- for inconsistencies
-
-gpdetective captures the following files and HAWQ system information:
-
- * postgresql.conf configuration files
- * log files (master and segments)
- * HAWQ system configuration information
- * (optional) Core files
- * (optional) Schema DDL dumps for all databases and global objects
-
-A bzip2-compressed tar output file containing this information is created
-in the current directory with a file name of gpdetective<timestamp>.tar.bz2.
-
-
-*****************************************************
-OPTIONS
-*****************************************************
-
---connect t|f
-
- Specifies if gpdetective should connect to the database to obtain
- system information. The default is true (t). If false (f),
- gpdetective only gathers information it can obtain without making
- a connection to the database. This information includes (from the
- master host):
-
- * Log files
- * The <master_data_directory>/postgresql.conf file
- * The ~/gpAdminLogs directory
- * gpcheckos output
- * Core files
-
-
---cores t|f
-
- Determines whether or not the utility retrieves core files. The
- default is true (t).
-
-
---diagnostics a|n|s|o|c
-
- Specifies the diagnostic tests to run: all (a), none (n),
- operating system (o) diagnostics, or catalog (c) diagnostics.
- The default is all (a).
-
-
---end_date YYYY-MM-DD
-
- Sets the end date for the diagnostic information collected. The
- collected information ends at 00:00:00 of the specified date.
-
-
--h hostname
-
- The host name of the machine on which the HAWQ master
- database server is running. If not specified, reads from the
- environment variable PGHOST or defaults to localhost.
-
-
---logs a|n|dbid_list
-
- Specifies which log file(s) to retrieve: all (a), none (n), a
- comma separated list of segment dbid numbers, or a range of dbid
- numbers divided by a dash (-) (for example, 3-6 retrieves logs
- from segments 3, 4, 5, and 6). The default is all (a).
-
-
--P password
-
- If HAWQ is configured to use password authentication,
- you must also supply the database superuser password. If not specified,
- reads from ~/.pgpass if it exists.
-
-
---pg_dumpall t|f
-
- Determines whether or not the utility runs pg_dumpall to collect
- schema DDL for all databases and global objects. The default is true (t).
-
-
---pg_dump_options option[,...]
-
- If --pg_dumpall is true, specifies a comma separated list of dump
- options to use when the pg_dumpall utility is called. See pg_dumpall
- for a valid list of dump options.
-
-
--p port
-
- The TCP port on which the HAWQ master server is listening
- for connections. If not specified, reads from the environment variable
- PGPORT or defaults to 5432.
-
-
---start_date number_of_days | YYYY-MM-DD
-
- Sets the start date for the diagnostic information collected. Specify
- either the number of days prior, or an explicit past date.
-
-
---tempdir temp_dir
-
- Specifies the temporary directory used by gpdetective. The default
- value is determined by the $TEMP, $TMP and $TMPDIR environment variables.
-
-
--U gp_superuser
-
- The HAWQ superuser role name to connect as (typically gpadmin).
- If not specified, reads from the environment variable PGUSER or
- defaults to the current system user name.
-
-
--v (show utility version)
-
- Displays the version of this utility.
-
-
--? (help)
-
- Displays the utility usage and syntax.
-
-
-*****************************************************
-EXAMPLES
-*****************************************************
-
-Collect all diagnostic information for a HAWQ system
-and supply the required connection information for the master host:
-
- gpdetective -h mdw -p 54320 -U gpadmin -P mypassword
-
-
-Run diagnostics and collect all logs and system information for the
-past two days:
-
- gpdetective --start_date 2
-
-
-To collect the log files of the master and segment without
-diagnostic tests or schema dumps:
-
- gpdetective --diagnostics n --logs -1,3 --pg_dumpall f
-
-
-*****************************************************
-SEE ALSO
-*****************************************************
-
-gpstate, gpcheckos, pg_dumpall
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/doc/gpinitstandby_help
----------------------------------------------------------------------
diff --git a/tools/doc/gpinitstandby_help b/tools/doc/gpinitstandby_help
deleted file mode 100755
index 739e0fb..0000000
--- a/tools/doc/gpinitstandby_help
+++ /dev/null
@@ -1,160 +0,0 @@
-COMMAND NAME: gpinitstandby
-
-Adds and/or initializes a standby master host for a Greenplum Database system.
-
-
-*****************************************************
-SYNOPSIS
-*****************************************************
-
-gpinitstandby { -s <standby_hostname> | -r | -n }
- [-M smart | -M fast] [-a] [-q] [-D] [-L]
- [-l <logfile_directory>]
-
-
-gpinitstandby -? | -v
-
-
-*****************************************************
-DESCRIPTION
-*****************************************************
-
-The gpinitstandby utility adds a backup master host to your
-Greenplum Database system. If your system has an existing backup
-master host configured, use the -r option to remove it before adding
-the new standby master host.
-
-Before running this utility, make sure
-that the Greenplum Database software is installed on the backup master
-host and that you have exchanged SSH keys between hosts. Also make sure
-that the master port is set to the same port number on the master host
-and the backup master host. This utility should be run on the currently
-active primary master host.
-
-The utility will perform the following steps:
-
-* Shutdown your Greenplum Database system
-* Update the Greenplum Database system catalog to remove the
- existing backup master host information (if the -r option is supplied)
-* Update the Greenplum Database system catalog to add the new backup
- master host information (use the -n option to skip this step)
-* Edit the pg_hba.conf files of the segment instances to allow access
- from the newly added standby master.
-* Setup the backup master instance on the alternate master host
-* Start the synchronization process
-* Restart your Greenplum Database system
-
-A backup master host serves as a 'warm standby' in the event of the
-primary master host becoming unoperational. The backup master is kept
-up to date by a transaction log replication process (gpsyncagent),
-which runs on the backup master host and keeps the data between the
-primary and backup master hosts synchronized. If the primary master
-fails, the log replication process is shutdown, and the backup master
-can be activated in its place by using the gpactivatestandby utility.
-Upon activation of the backup master, the replicated logs are used to
-reconstruct the state of the master host at the time of the last
-successfully committed transaction.
-
-
-*****************************************************
-OPTIONS
-*****************************************************
-
--s <standby_hostname>
-
-The host name of the standby master host.
-
-
--r (remove standby master)
-
-Removes the currently configured standby master host from your
-Greenplum Database system.
-
-
--n (resynchronize)
-
-Use this option if you already have a standby master configured,
-and just want to resynchronize the data between the primary and
-backup master host. The Greenplum system catalog tables will not
-be updated.
-
-
--M fast (fast shutdown - rollback)
-
-Use fast shut down when stopping Greenplum Database at the beginning
-of the standby initialization process. Any transactions in progress
-are interrupted and rolled back.
-
-
--M smart (smart shutdown - warn)
-
-Use smart shut down when stopping Greenplum Database at the beginning
-of the standby initialization process. If there are active connections,
-this command fails with a warning. This is the default shutdown mode.
-
-
--L (leave database stopped)
-
-Leave Greenplum Database in a stopped state after removing the warm
-standby master.
-
--a (do not prompt)
-
-Do not prompt the user for confirmation.
-
-
--q (no screen output)
-
-Run in quiet mode. Command output is not displayed on the screen,
-but is still written to the log file.
-
-
--l <logfile_directory>
-
-The directory to write the log file. Defaults to ~/gpAdminLogs.
-
-
--D (debug)
-
-Sets logging level to debug.
-
-
--? (help)
-
-Displays the online help.
-
-
--v (show script version)
-
-Displays the version of this utility.
-
-
-*****************************************************
-EXAMPLES
-*****************************************************
-
-Add a backup master host to your Greenplum Database system and
-start the synchronization process:
-
-gpinitstandby -s host09
-
-
-Remove the existing backup master from your Greenplum system configuration:
-
-gpinitstandby -r
-
-
-Start an existing backup master host and synchronize the data
-with the primary master host - do not add a new Greenplum backup
-master host to the system catalog:
-
-gpinitstandby -n
-
-Note: Do not specify the -n and -s options in the same command.
-
-
-*****************************************************
-SEE ALSO
-*****************************************************
-
-gpinitsystem, gpaddmirrors, gpactivatestandby
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/doc/gpkill_help
----------------------------------------------------------------------
diff --git a/tools/doc/gpkill_help b/tools/doc/gpkill_help
deleted file mode 100644
index 4e6db2d..0000000
--- a/tools/doc/gpkill_help
+++ /dev/null
@@ -1,77 +0,0 @@
-COMMAND NAME: gpkill
-
-Checks or terminates a Greenplum Database process.
-Users other than the superuser can only use gpkill
-to terminate their own processes.
-
-*****************************************************
-SYNOPSIS
-*****************************************************
-
-gpkill [options] pid
-gpkill --version
-gpkill -? | -h | --help
-
-*****************************************************
-DESCRIPTION
-*****************************************************
-
-
-This utility checks or terminates a Greenplum process.
-If the process is a critical Greenplum Database process
-or a system process that is not part of Greenplum, gpkill
-does not terminate it.
-
-After gpkill verifies that the specified process can be
-terminated safely, it prompts for confirmation. Prior to
-terminating a process, gpkill attempts to capture
-troubleshooting information, if the user has appropriate
-operating system priviliges.
-
-* The troubleshooting information is captured, even if
- the user does not confirm killing the process.
-
-* Failure to capture troubleshooting information does not
- stop gpkill from proceeding.
-
-
-*****************************************************
-OPTIONS
-*****************************************************
-
-pid
-The process ID to check or terminate.
-
---check
-Checks the specified process ID to verify that it is a
-Greenplum process and can safely be killed, but does not
-erminate it.
-
--v
-Displays verbose debugging information.
-
--q
-Enables quiet mode. Informational messages are suppressed.
-
-NOTE: Choosing both the -v and -q options sends the verbose
-debugging information to the system log, but does not display
-informational messages on stdout.
-
--? | -h | --help (help)
-Displays the online help.
-
-
-*****************************************************
-EXAMPLES
-*****************************************************
-
-
-Kill process 27893
-
- gpkill 27893
-
-Check process 27893 to see if it can be killed. Send
-debugging information to the system log, but do not
-display informational messages.
-
- gpkill -q -v --check 27893
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/doc/gpload_help
----------------------------------------------------------------------
diff --git a/tools/doc/gpload_help b/tools/doc/gpload_help
index 225b2ff..de62428 100644
--- a/tools/doc/gpload_help
+++ b/tools/doc/gpload_help
@@ -69,7 +69,7 @@ OPTIONS
-l log_file
Specifies where to write the log file. Defaults to
- ~/gpAdminLogs/hawq_load_YYYYMMDD.
+ ~/hawqAdminLogs/hawq_load_YYYYMMDD.
-v (verbose mode)
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/doc/gpperfmon_install_help
----------------------------------------------------------------------
diff --git a/tools/doc/gpperfmon_install_help b/tools/doc/gpperfmon_install_help
deleted file mode 100644
index 3a802d2..0000000
--- a/tools/doc/gpperfmon_install_help
+++ /dev/null
@@ -1,147 +0,0 @@
-COMMAND NAME: gpperfmon_install
-
-Installs the gpperfmon database and optionally enables the data
-collection agents.
-
-
-*****************************************************
-SYNOPSIS
-*****************************************************
-
-gpperfmon_install
- [--enable --password <gpmon_password> --port <gpdb_port>]
- [--pgpass <path_to_file>]
- [--verbose]
-
-
-gpperfmon_install --help | -h | -?
-
-
-*****************************************************
-DESCRIPTION
-*****************************************************
-
-The gpperfmon_install utility automates the steps required
-to enable the performance monitor data collection agents. You
-must be the Greenplum Database administrative user (gpadmin)
-in order to run this utility. If using the --enable option,
-Greenplum Database must be restarted after the utility completes.
-
-When run without any options, the utility will just create the
-gpperfmon database (the database used to store performance monitor
-data). When run with the --enable option, the utility will also
-run the following additional tasks necessary to enable the
-performance monitor data collection agents:
-
-1. Creates the gpmon superuser role in Greenplum Database.
- The performance monitor data collection agents require this
- role to connect to the database and write their data. The
- gpmon superuser role uses MD5-encrypted password authentication
- by default. Use the --password option to set the gpmon superuser�s
- password. Use the --port option to supply the port of the
- Greenplum Database master instance.
-
-2. Updates the $MASTER_DATA_DIRECTORY/pg_hba.conf file. The
- utility will add the following line to the host-based
- authentication file (pg_hba.conf). This allows the gpmon
- user to locally connect to any database using MD5-encrypted
- password authentication:
- local all gpmon md5
-
-3. Updates the password file (.pgpass). In order to allow the
- data collection agents to connect as the gpmon role without
- a password prompt, you must have a password file that has an
- entry for the gpmon user. The utility add the following entry
- to your password file (if the file does not exist, the utility
- will create it):
- *:5432:gpperfmon:gpmon:gpmon_password
- If your password file is not located in the default location
- (~/.pgpass), use the --pgpass option to specify the file location.
-
-4. Sets the server configuration parameters for performance monitor.
- The following parameters must be enabled in order for the data
- collection agents to begin collecting data. The utility will set
- the following parameters in the Greenplum Database postgresql.conf
- configuration files:
- gp_enable_gpperfmon=on (in all postgresql.conf files)
- gpperfmon_port=8888 (in the master postgresql.conf file)
- gp_external_enable_exec=on (in the master postgresql.conf file)
-
-
-*****************************************************
-OPTIONS
-*****************************************************
-
---enable
-
- In addition to creating the gpperfmon database, performs the
- additional steps required to enable the performance monitor
- data collection agents. When --enable is specified the utility
- will also create and configure the gpmon superuser account and
- set the performance monitor server configuration parameters in
- the postgresql.conf files.
-
-
---password <gpmon_password>
-
- Required if --enable is specified. Sets the password of the
- gpmon superuser.
-
-
-
---port <gpdb_port>
-
- Required if --enable is specified. Specifies the connection port
- of the Greenplum Database master.
-
-
-
---pgpass <path_to_file>
-
- Optional if --enable is specified. If the password file is not
- in the default location of ~/.pgpass, specifies the location of
- the password file.
-
-
-
---verbose
-
- Sets the logging level to verbose.
-
-
-
---help | -h | -?
-
- Displays the online help.
-
-
-
-*****************************************************
-EXAMPLES
-*****************************************************
-
-Create the gpperfmon database only:
-
- $ su - gpadmin
-
- $ gpperfmon_install
-
-
-Create the gpperfmon database, create the gpmon superuser,
-and enable the performance monitor agents:
-
- $ su - gpadmin
-
- $ gpperfmon_install --enable --password p@$$word --port 5432
-
- $ gpstop -r
-
-
-
-*****************************************************
-SEE ALSO
-*****************************************************
-
-gpstop
-
-
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/doc/gpsnmpd_help
----------------------------------------------------------------------
diff --git a/tools/doc/gpsnmpd_help b/tools/doc/gpsnmpd_help
deleted file mode 100644
index 2043d55..0000000
--- a/tools/doc/gpsnmpd_help
+++ /dev/null
@@ -1,147 +0,0 @@
-COMMAND NAME: gpsnmpd
-
-Reports on the health and state of a Greenplum Database system
-through SNMP.
-
-
-*****************************************************
-SYNOPSIS
-*****************************************************
-
-gpsnmpd -s -C connect_string [-b] [-g] [-m MIB:...]
- [-M directory:...]
-
-gpsnmpd -c FILE -C connect_string [-x address:port] [-b] [-g]
- [-m MIB:...] [-M directory:...]
-
-gpsnmpd -?
-
-gpsnmpd --version
-
-
-*****************************************************
-DESCRIPTION
-*****************************************************
-
-Greenplum�s gpsnmpd agent is an SNMP (Simple Network Management Protocol)
-daemon that reports on the health and state of a Greenplum Database
-system by using a set of MIBs (Management Information Bases). MIBs are a
-collection of objects that describe an SNMP-manageable entity; in this
-case, a Greenplum Database system. In a typical environment, gpsnmpd is
-polled by a network monitor and returns information on a Greenplum
-Database system. It currently supports the generic RDBMS MIB and
-typically operates on the master host.
-
-gpsnmpd works in conjunction with the SNMP support that (normally)
-already exists on the Greenplum Database system. gpsnmpd does not
-replace the system snmpd agent that monitors items such as hardware,
-processor, memory, and network functions. However, you can run the
-Greenplum SNMP agent as a stand-alone agent if required.
-
-As a standalone SNMP agent, gpsnmpd listens (on a network socket) for
-SNMP queries, and requires the same extensive configuration as the
-system SNMP agent.
-
-Greenplum recommends that you run gpsnmpd as a sub-agent to the system
-agent. When it starts, the gpsnmpd sub-agent registers itself with the
-system-level SNMP agent, and communicates to the system agent the parts
-of the MIB of which it is aware. The system agent communicates with the
-SNMP client/network monitoring application and forwards requests for
-particular sections of the MIB to the gpsnmpd sub-agent. Note that the
-gpsnmpd sub-agent communicates with the system agent through UNIX sockets;
-it does not listen on network sockets when used as a sub-agent.
-
-
-*****************************************************
-DESCRIPTION
-*****************************************************
-
--s (sub-agent)
-
-Run gpsnmpd as an AgentX sub-agent to the system snmpd process. You do not
-need to use the -x option when using this option.
-
--b (background)
-
-Run gpsnmpd as a background process.
-
-
--c (configuration file)
-
-Specify the SNMP configuration file to use when starting gpsnmpd as a
-stand-alone agent. Note that you can specify any configuration file to
-run gpsnmpd as a stand-alone agent; you do not have to use the
-/etc/snmp/snmpd.conf file (/etc/sma/snmp/ on Solaris platforms). The
-configuration file you use must include a value for rocommunity.
-
-
--g (use syslog)
-
-Logs gpsnmpd error messages to syslog
-
-
--C (libpq connection string)
-
-The libpq connection string to connect to Greenplum Database. Note that
-you can run gpsnmpd from a remote system. Depending on your network
-configuration, the gpsnmpd agent can establish a connection and monitor
-a remote Greenplum Database database instance. The configuration string
-can contain the database name, the host name, the port number, the
-username, the password, and other information if required.
-
-Greenplum recommends using the postgres database in the connection string
-(dbname=postgres). This is the default database if you do not use the �C
-option.
-
-
--x (address:port of a network interface)
-
-Specify an IP address for a network interface card on the host system,
-and specify a port other than the default SNMP port of 161. This enables
-you to run gpsnmpd without root permissions (you must have root permissions
-to use ports 1024 and lower).
-
-You do not need to specify this option if you are running gpsnmpd as an
-AgentX sub-agent (-s).
-
-
--m (MIB:...)
-
-Loads one or more MIBs when starting gpsnmpd. Use a colon (:) to separate
-the MIBs. Enter ALL to load all MIBs. If you do not enter -m in the gpsnmpd
-command, a default set of MIBs are loaded by default.
-
-
--M (directory:...)
-
-Loads all MIBs from one or more directories when starting gpsnmpd. Use a
-colon (:) to separate the each directory. Enter the full path to each
-directory you specify for this option. If you do not enter -M in the gpsnmpd
-command, a default set of MIBs are loaded by default.
-
-
--? (help)
-
-Displays the online help.
-
-
--V
-
-Displays the version of this utility.
-
-
-*****************************************************
-EXAMPLES
-*****************************************************
-
-Start gpsnmpd as an agentx subagent:
-
-# gpsnmpd -s -b -m ALL -C "host=gpmaster dbname=template1 \ user=gpadmin
- password=secret"
-
-
-Start gpsnmpd as a stand-alone agent:
-
-# gpsnmpd -b -c /etc/snmp/snmpd.conf -x \ 192.168.100.12:10161
- -M /usr/mibs/mymibs -C "host=gpmaster \ dbname=template1 user=gpadmin
- password=secret"
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/doc/gpsuspend_help
----------------------------------------------------------------------
diff --git a/tools/doc/gpsuspend_help b/tools/doc/gpsuspend_help
deleted file mode 100644
index cf67ff6..0000000
--- a/tools/doc/gpsuspend_help
+++ /dev/null
@@ -1,123 +0,0 @@
-COMMAND NAME: gpsuspend
-
-Pause and resume a running Greenplum Database
-
-******************************************************
-SYNOPSIS
-******************************************************
-
-gpsuspend --pause [--batchsize batchsize] [--noninteractive]
-
-gpsuspend --resume --pausefile pausefile_name [--batchsize batchsize]
-
-gpsuspend -? | -h | --help
-
-Prerequisites:
-
-* You are logged in as the Greenplum Database superuser (gpadmin).
-
-* You are on the machine that is running the master database
-
-* You are not running --pause on an already paused database
-
-
-*******************************************************
-DESCRIPTION
-*******************************************************
-
-The gpsuspend utility can pause a running instance of Greenplum Database.
-
-The utility is first run in 'pause' mode which will pause the database.
-In 'pause' mode, the successful output of the command will print the
-location of a generated pausefile which can be used to restore the
-system state.
-
-In 'resume' mode you must pass the location of the pause file which describes
-the list of segment hosts in a Greenplum database and can be used to resume
-the paused system
-
-By default the utility is run in interactive mode. In interactive mode
-The utitility will stop after pausing the database and wait for user entry.
-At this point the database is paused. When the administrator is ready to
-resume the database they can use the prompt to enter 'resume' and the database
-will be resumed. To disable interactive mode and run 'pause' and 'resume'
-independtly use the --noninteractive option with --pause.
-
-The utility pauses the database using unix signals STOP and CONT. If you want
-to confirm that the database is paused you can use gpssh and enter the command
-ps ax | grep postgres | grep -v grep. This will list all postgres processes
-on your cluster and the run state. All processes should be in a STOP state.
-Also note, the order in which the processes are paused and resumed is important.
-First the master postgres instance is paused and then the segments. Also within
-a postgres instance, first the postmaster process is paused and then its children.
-
-
-********************************************************
-OPTIONS
-********************************************************
-
-
--h (help)
-
-Displays the online help.
-
---pause
-
-Sets the utility into 'pause' mode
-
---resume
-
-Sets the utility into 'resume' mode
-
---pausefile <pausefilename>
-
-This option is used in 'resume' mode for the utility to know the
-location of the segments while the database is paused and inaccessible.
-The file is generated to the GPHOME directory during 'pause' mode.
-
---noninteractive
-
-This option will disable the default interactive mode.
-
--B <batch_size>
-
-The number of worker threads for connecting to segment hosts.
-By making this number higher, more parallel ssh connections will be
-made in order to complete the job faster.
-
---verbose | -v (verbose)
-
-Verbose debugging output.
-
--? | h (help)
-
-Displays the online help.
-
-
-*********************************************************
-EXAMPLES
-*********************************************************
-
-Pause a running Greenplum database:
-
-$ gpsuspend --pause --noninteractive
-
-
-Resume a running Greenplum database using a pausefile:
-
-$ gpsuspend --resume --pausefile /home/gpadmin/greenplum-db/./gp_pause.20091113.2158.dat
-
-Running in interactive mode:
-
-$ gpsuspend --pause
-Database is paused. When you are ready, type a command below to resume or quit.
- quit|resume (default=quit):
-$ resume
---done--
-
-
-**********************************************************
-SEE ALSO
-**********************************************************
-
-gpstart, gpstop
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/sbin/gpaddconfig.py
----------------------------------------------------------------------
diff --git a/tools/sbin/gpaddconfig.py b/tools/sbin/gpaddconfig.py
deleted file mode 100755
index 5811291..0000000
--- a/tools/sbin/gpaddconfig.py
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (c) Greenplum Inc 2009. All Rights Reserved.
-#
-# This is a private script to be called by gpaddconfig
-# The script is executed on a single machine and gets a list of data directories to modify from STDIN
-# With the script you can either change the value of a setting (and comment out all other entries for that setting)
-# or you can do remove only, to comment out all entries of a setting and not add an entry.
-#
-try:
-
- import sys, os
- from optparse import Option, OptionParser
- from gppylib.gpparseopts import OptParser, OptChecker
- from gppylib.gparray import *
- from gppylib.commands.gp import *
- from gppylib.db import dbconn
- from gppylib.gpcoverage import GpCoverage
-
-except ImportError, e:
- sys.exit('Cannot import modules. Please check that you have sourced greenplum_path.sh. Detail: ' + str(e))
-
-_help = [""""""
-
-]
-
-def parseargs():
-
- parser = OptParser(option_class=OptChecker)
-
- parser.setHelp(_help)
-
- parser.remove_option('-h')
- parser.add_option('-h', '-?', '--help', action='help', help='show this help message and exit')
-
- parser.add_option('--entry', type='string')
- parser.add_option('--value', type='string')
- parser.add_option('--removeonly', action='store_true')
- parser.set_defaults(removeonly=False)
-
- # Parse the command line arguments
- (options, args) = parser.parse_args()
-
- # sanity check
- if not options.entry:
- print "--entry is required"
- sys.exit(1)
-
- if (not options.value) and (not options.removeonly):
- print "Select either --value or --removeonly"
- sys.exit(1)
-
- return options
-
-
-#------------------------------- Mainline --------------------------------
-coverage = GpCoverage()
-coverage.start()
-
-try:
- options = parseargs()
-
- files = list()
-
- # get the files to edit from STDIN
- line = sys.stdin.readline()
- while line:
-
- directory = line.rstrip()
-
- filename = directory + "/postgresql.conf"
- if not os.path.exists( filename ):
- raise Exception("path does not exist" + filename)
-
- files.append(filename)
-
- line = sys.stdin.readline()
-
-
- fromString = "(^\s*" + options.entry + "\s*=.*$)"
- toString="#$1"
- name = "mycmd"
-
- # update all the files
- for f in files:
-
- # comment out any existing entries for this setting
- cmd=InlinePerlReplace(name, fromString, toString, f)
- cmd.run(validateAfter=True)
-
- if options.removeonly:
- continue
-
- cmd = GpAppendGucToFile(name, f, options.entry, options.value)
- cmd.run(validateAfter=True)
-finally:
- coverage.stop()
- coverage.generate_report()
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/sbin/gpchangeuserpassword
----------------------------------------------------------------------
diff --git a/tools/sbin/gpchangeuserpassword b/tools/sbin/gpchangeuserpassword
deleted file mode 100755
index 0279330..0000000
--- a/tools/sbin/gpchangeuserpassword
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/usr/bin/env python
-'''
-USAGE: gpchangeuserpassword --user USER --password PASSWORD
- where USER is the user for whom the password is being changed
- where PASSWORD is the new password
-'''
-
-import os, sys, getpass, crypt
-from subprocess import Popen
-sys.path.append(sys.path[0] + '/../bin/lib')
-
-try:
- import pexpect
- from optparse import Option, OptionParser
- from gppylib.gpparseopts import OptParser, OptChecker
- from gppylib.commands.unix import SYSTEM
-except ImportError, e:
- sys.exit('Cannot import modules. Please check that you have sourced greenplum_path.sh. Detail: ' + str(e))
-
-options = None
-
-parser = OptParser(option_class=OptChecker)
-parser.remove_option('-h')
-parser.add_option('-h', '-?', '--help', action='store_true')
-parser.add_option('-u', '--user', type='string')
-parser.add_option('-p', '--password', type='string')
-(options, args) = parser.parse_args()
-
-global gphome
-gphome = os.environ.get('GPHOME')
-if not gphome:
- sys.stderr.write("GPHOME not set\n")
- sys.exit(1)
-
-if options.help:
- sys.stderr.write(__doc__)
- sys.exit(0)
-
-if not options.user:
- sys.stderr.write("--user must be specified\n")
- sys.exit(1)
-
-if not options.password:
- sys.stderr.write("--password must be specified\n")
- sys.exit(1)
-
-if options.user == "root":
- sys.stderr.write("root password can not be changed with this utility\n")
- sys.exit(1)
-
-if getpass.getuser() != "root":
- sys.stderr.write("this utility must be run as root\n")
- sys.exit(1)
-
-####################################################################################################
-if SYSTEM.getName() == "linux":
-
- cmdstr = 'usermod -p "%s" %s' % (crypt.crypt(options.password, options.password), options.user)
- p = Popen(cmdstr, shell=True, executable="/bin/bash")
- sts = os.waitpid(p.pid, 0)[1]
- if sts:
- sys.stderr.write("error on cmd: %s\n" % cmdstr)
- sys.exit(1)
- else:
- sys.exit(0)
-####################################################################################################
-
-if SYSTEM.getName() != "sunos":
- sys.stderr.write("linux and solaris are the only operating systems supported by this utility\n")
- sys.exit(1)
-
-# SOLARIS password change
-# New Password:
-# Re-enter new Password:
-# passwd: They don't match.
-# passwd: password successfully changed for ivanfoo
-
-done = False
-child = None
-
-try:
- cmdstr = "passwd %s" % options.user
- child = pexpect.spawn(cmdstr)
-
- index = 0
- while 1:
- index = child.expect(["match", "success", "Password", pexpect.EOF, pexpect.TIMEOUT])
- if index == 0:
- sys.stderr.write("passwords did not match\n")
- sys.exit(1)
- elif index == 1:
- child.close
- sys.exit(0)
- elif index == 2:
- child.sendline(options.password)
- continue
- elif index == 3:
- sys.stderr.write("error calling passwd\n")
- sys.exit(1)
- elif index == 4:
- sys.stderr.write("timeout calling passwd\n")
- sys.exit(1)
- else:
- sys.stderr.write("error2 calling passwd\n")
- sys.exit(1)
-
-except Exception, e:
- sys.stderr.write("Exception running cmd: %s\n" % cmdstr)
- sys.stderr.write("%s\n" % e.__str__())
- sys.exit(1)
[3/3] incubator-hawq git commit: HAWQ-158. Remove legacy command line
tools and help.
Posted by rl...@apache.org.
HAWQ-158. Remove legacy command line tools and help.
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/3691f236
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/3691f236
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/3691f236
Branch: refs/heads/master
Commit: 3691f2367371001b1ac56156affb587d07459c56
Parents: cfeba47
Author: rlei <rl...@pivotal.io>
Authored: Sat Nov 14 11:18:41 2015 +0800
Committer: rlei <rl...@pivotal.io>
Committed: Sat Nov 14 15:41:01 2015 +0800
----------------------------------------------------------------------
tools/Makefile | 6 -
tools/bin/Makefile | 2 +-
tools/bin/gpchecksubnetcfg | 325 -------
tools/bin/gpdebug | 382 --------
tools/bin/gpdetective | 1288 -------------------------
tools/bin/gpfaultinjector | 17 -
tools/bin/gpload.py | 4 +-
tools/bin/gppylib/gplog.py | 8 +-
tools/bin/gpverify | 8 -
tools/bin/lib/gp_bash_functions.sh | 2 +-
tools/doc/gp_dump_help | 316 ------
tools/doc/gp_restore_help | 218 -----
tools/doc/gpaddmirrors_help | 253 -----
tools/doc/gpbitmapreindex_help | 111 ---
tools/doc/gpcheckos.xml | 91 --
tools/doc/gpcheckos_help | 3 -
tools/doc/gpcrondump_help | 330 -------
tools/doc/gpdbrestore_help | 203 ----
tools/doc/gpdeletesystem_help | 97 --
tools/doc/gpdetective_help | 187 ----
tools/doc/gpinitstandby_help | 160 ---
tools/doc/gpkill_help | 77 --
tools/doc/gpload_help | 2 +-
tools/doc/gpperfmon_install_help | 147 ---
tools/doc/gpsnmpd_help | 147 ---
tools/doc/gpsuspend_help | 123 ---
tools/sbin/gpaddconfig.py | 98 --
tools/sbin/gpchangeuserpassword | 110 ---
tools/sbin/gpcleansegmentdir.py | 96 --
tools/sbin/gpgetstatususingtransition.py | 221 -----
tools/sbin/gpoperation.py | 62 --
tools/sbin/gpsetdbid.py | 91 --
tools/sbin/gpstandbywatch.py | 220 -----
33 files changed, 9 insertions(+), 5396 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/Makefile
----------------------------------------------------------------------
diff --git a/tools/Makefile b/tools/Makefile
index bc2d5bd..21d806f 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -38,13 +38,7 @@ SET_VERSION_SCRIPTS = \
bin/gpssh-exkeys \
bin/gpsys1 \
bin/lib/gpcheckcat \
- sbin/gpaddconfig.py \
- sbin/gpchangeuserpassword \
sbin/gpcheck_hostdump \
- sbin/gpcleansegmentdir.py \
- sbin/gpfixuserlimts \
- sbin/gpgetstatususingtransition.py \
- sbin/gpsetdbid.py \
lib/python/gppylib/programs/clsAddMirrors.py \
lib/python/gppylib/programs/clsHostCacheLookup.py \
lib/python/gppylib/programs/clsInjectFault.py \
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/bin/Makefile
----------------------------------------------------------------------
diff --git a/tools/bin/Makefile b/tools/bin/Makefile
index f675567..afc7b93 100644
--- a/tools/bin/Makefile
+++ b/tools/bin/Makefile
@@ -227,7 +227,7 @@ clean :
distclean: clean
rm -rf $(NETPERF_DIR)
-SKIP_INSTALL=.epydoc.config|.gitignore|.p4ignore|.rcfile|Makefile|gpchecksubnetcfg|generate-greenplum-path.sh
+SKIP_INSTALL=.epydoc.config|.gitignore|.p4ignore|.rcfile|Makefile|generate-greenplum-path.sh
install: all
${INSTALL_SCRIPT} -d ${bindir}
for files in `find * -maxdepth 0 -type f | grep -x -v -E "${SKIP_INSTALL}"`; do ${INSTALL_SCRIPT} $${files} ${bindir}; done
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/bin/gpchecksubnetcfg
----------------------------------------------------------------------
diff --git a/tools/bin/gpchecksubnetcfg b/tools/bin/gpchecksubnetcfg
deleted file mode 100755
index 0f40044..0000000
--- a/tools/bin/gpchecksubnetcfg
+++ /dev/null
@@ -1,325 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Copyright (c) Greenplum Inc 2010. All Rights Reserved.
-#
-
-import os
-
-# import GPDB modules
-try:
- from gppylib.gpparseopts import *
- from gppylib.gplog import *
- from gppylib.gparray import GpArray
- from gppylib.db import dbconn
- from gppylib.commands.base import WorkerPool, Command, LOCAL, REMOTE
-except ImportError, e:
- sys.exit('ERROR: Cannot import modules. Please check that you '
- 'have sourced greenplum_path.sh. Detail: ' + str(e))
-
-EXECNAME = os.path.split(__file__)[-1]
-
-FIX_SUBNET_DESC="Updated address for dbid %s to fix primary/mirror subnet conflict."
-
-#-------------------------------------------------------------------------
-# SQL Queries
-#-------------------------------------------------------------------------
-
-#Segment count per hostname
-SEG_COUNT_PER_HOST_SQL="""
- SELECT hostname, count(*)
- FROM gp_segment_configuration
- WHERE content > -1 GROUP BY 1 ORDER BY 2
-"""
-
-UNIQUE_HOSTNAMES_SQL="""
- SELECT distinct(hostname) from gp_segment_configuration
-"""
-
-# Primary segments on same subnet as it's mirror segment
-PRIMARY_MIRROR_SAME_SUBNET_SQL="""
- SELECT p.dbid AS primary_dbid, m.dbid AS mirror_dbid,
- p.hostname AS primary_hostname, m.hostname AS mirror_hostname,
- p.address AS primary_addr, m.address AS mirror_addr
- FROM gp_segment_configuration p JOIN gp_segment_configuration m
- ON p.content = m.content WHERE p.role = 'p' AND m.role = 'm' AND p.content > -1
- AND substr(p.address, strpos(p.address, '-') + 1) = substr(m.address, strpos(m.address, '-') + 1)
- ORDER BY 1
-"""
-
-IN_FAULT_OR_RECOVERY_SQL="""
- SELECT *
- FROM gp_segment_configuration
- WHERE role <> preferred_role OR status = 'd' OR mode <> 's'
-"""
-
-
-class GetApplianceVersion(Command):
-
- DCA_VERSION_FILE='/etc/gpdb-appliance-version'
-
- def __init__(self, name,ctxt=LOCAL, remoteHost=None):
- cmdStr = 'cat %s' % GetApplianceVersion.DCA_VERSION_FILE
- Command.__init__(self,name,cmdStr,ctxt,remoteHost)
-
- def get_version(self):
- try:
- res = self.get_results()
- (major, minor, subminor, subsubminor) = res.stdout.strip().split('.')
- except Exception, ex:
- major=0
- minor=0
- subminor=0
- subsubminor=0
- return (int(major), int(minor), int(subminor), int(subsubminor))
-
-def parseargs():
- """parses and validates command line args."""
-
- parser = OptParser(option_class=OptChecker,
- version='%prog version $Revision: #1 $')
- parser.setHelp([])
- parser.remove_option('-h')
-
- # General options section
- optgrp = OptionGroup(parser, 'General options')
- optgrp.add_option('-?', '--help', dest='help', action='store_true',
- help='display this help message and exit')
- optgrp.add_option('-v', dest='version', action='store_true',
- help='display version information and exit')
- parser.add_option_group(optgrp)
-
- # Logging options section
- optgrp = OptionGroup(parser, 'Logging options')
- optgrp.add_option('-q', '--quiet', action='store_true',
- help='quiet mode, do not log progress to screen')
- optgrp.add_option('-D', '--debug', action='store_true', default=False,
- help='enable debug logging')
- parser.add_option_group(optgrp)
-
- # SQL generation options
- optgrp = OptionGroup(parser, 'Output options')
- optgrp.add_option('-o', '--out-file', type='string', dest='out_file',
- help='Filename to output fix SQL')
- optgrp.add_option('-c', '--check-only', action='store_true', dest='check_only',
- help='Only validate configuration. Do not generate SQL.')
- parser.add_option_group(optgrp)
-
- # Parse the command line arguments
- (options, args) = parser.parse_args()
-
- if options.help:
- parser.print_help()
- parser.exit(0, None)
-
- if options.version:
- parser.print_version()
- parser.exit(0, None)
-
- if options.out_file and options.check_only:
- logger.error("-c and -o cannot be specified together.")
- parser.exit(1, None)
-
- if not options.out_file and not options.check_only:
- logger.error("Option -c or -o must be specified.")
- parser.exit(1, None)
-
- return (options, args)
-
-
-#-------------------------------------------------------------------------
-def db_to_str(db):
- return "%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s" % (db.content,
- db.dbid,
- db.role,
- db.preferred_role,
- db.mode,
- db.status,
- db.hostname,
- db.address,
- db.port,
- db.datadir,
- db.replicationPort)
-
-
-#-------------------------------------------------------------------------
-def seg_count_per_host_is_valid(conn):
- curr = dbconn.execSQL(conn, SEG_COUNT_PER_HOST_SQL)
- res = curr.fetchall()
- curr.close()
-
- return res[0][1] == res[-1][1]
-
-
-#-------------------------------------------------------------------------
-def get_wrong_subnet_segments(conn):
- res = []
- curr = dbconn.execSQL(conn, PRIMARY_MIRROR_SAME_SUBNET_SQL)
- for r in curr:
- res.append(r)
- curr.close()
-
- return res
-
-
-
-#-------------------------------------------------------------------------
-def generate_fix_sql(filename, gparray, wrong_subnet_segs):
- fp = None
-
- us_dict = {}
- for us in wrong_subnet_segs:
- us_dict[us[1]] = True
-
- try:
- fp = open(filename, 'w')
- logger.info("Writing update SQL to %s" % filename)
-
- fp.write("-- content, dbid, role, preferred_role, mode, status, hostname, address, port, datadir, replicationPort\n")
- fp.write("-- ----------------------------------------------------------------------------------------------------\n")
- for db in gparray.getDbList():
- if us_dict.has_key(db.dbid):
- fp.write("-- *** %s\n" % db_to_str(db))
- else:
- fp.write("-- %s\n" % db_to_str(db))
-
- fp.write("\n")
- for us in wrong_subnet_segs:
- (host,interface) = us[5].split('-')
- if interface == '1':
- new_address = '%s-%s' % (host, '2')
- else:
- new_address = '%s-%s' % (host, '1')
-
- fp.write("UPDATE gp_segment_configuration SET address = '%s' WHERE dbid = %s;\n" % (new_address, us[1]))
- fp.write("INSERT INTO gp_configuration_history VALUES (now(), %s, '%s');\n" % (us[1], FIX_SUBNET_DESC % us[1]))
- fp.write("\n")
- except:
- raise
- finally:
- if fp:
- fp.close()
-
-
-#-------------------------------------------------------------------------
-def validate_appliance_version(conn):
- res = True
- curr = dbconn.execSQL(conn, UNIQUE_HOSTNAMES_SQL)
- hosts = curr.fetchall()
- curr.close()
-
- try:
- pool = WorkerPool()
-
- for h in hosts:
- cmd = GetApplianceVersion('Appliance ver on %s' % h[0], ctxt=REMOTE, remoteHost=h[0])
- pool.addCommand(cmd)
-
- pool.wait_and_printdots(len(hosts))
-
- for cmd in pool.getCompletedItems():
- (major, minor, subminor, subsubminor) = cmd.get_version()
- if major != 1 or minor > 0:
- res = False
- except Exception, ex:
- res = False
- logger.exception(ex)
- finally:
- pool.haltWork()
- pool.joinWorkers()
-
- return res
-
-
-
-
-#-------------------------------------------------------------------------
-def is_in_fault(conn):
- curr = dbconn.execSQL(conn, IN_FAULT_OR_RECOVERY_SQL)
- segs_in_fault = curr.rowcount
- curr.close()
- return segs_in_fault != 0
-
-
-
-#-------------------------------------------------------------------------
-# Main
-#-------------------------------------------------------------------------
-
-if __name__ == '__main__':
- url = None
- conn = None
- gparray = None
- incorrect_subnet_cfg = False
- logger = get_default_logger()
-
- try:
- (options, args) = parseargs()
-
- # Turn on debug logging if needed
- if options.debug:
- enable_verbose_logging()
- elif options.quiet:
- quiet_stdout_logging()
-
- url = dbconn.DbURL()
- logger.info("Connecting to %s@%s:%s..." % (url.pguser, url.pghost, url.pgport))
- conn = dbconn.connect(url, verbose=options.debug)
-
- logger.info("Checking appliance version...")
- if not validate_appliance_version(conn):
- logger.error('One or more hosts in the array are running an appliance version')
- logger.error('later than 1.0.2.0. This utility is not designed for hardware')
- logger.error('used by this version.')
- sys.exit(1)
-
- logger.info("Checking segment state...")
- if is_in_fault(conn):
- logger.error("Currently there are segments that are not in their preferred role")
- logger.error("or are in the process of resyncronizing. This utility cannot validate")
- logger.error("the segment configuration while the database is in this state.")
- logger.error("Please rerun this utility after segment recovery has completed.")
- sys.exit(1)
-
- logger.info("Checking segment configuration...")
- if not seg_count_per_host_is_valid(conn):
- logger.error("The check of segment configuration found that some hosts")
- logger.error("have more segments than others. This utility cannot handle")
- logger.error("this configuration. Please contact EMC/Greenplum support for")
- logger.error("assistance with your configuration.")
- sys.exit(3)
-
- logger.info("Retrieving array configuration...")
- gparray = GpArray.initFromCatalog(url)
-
- logger.info("Checking for mirror segments on incorrect subnet...")
- wrong_subnet_segs = get_wrong_subnet_segments(conn)
- if len(wrong_subnet_segs) > 0:
- incorrect_subnet_cfg = True
- if options.out_file:
- generate_fix_sql(options.out_file, gparray, wrong_subnet_segs)
- logger.info("You should verify the generated SQL file with EMC/Greenplum")
- logger.info("support prior to executing it.")
- else:
- logger.info("%s mirror segments were found to be on the same subnet" % len(wrong_subnet_segs))
- logger.info("as their associated primary segment.")
- logger.info("You can run %s with the -o option to generate a SQL" % EXECNAME)
- logger.info("file that will correct this configuration issue.")
- else:
- logger.info("Primary and mirror segments appear to be on the")
- logger.info("correct subnets already.")
-
- logger.info("Done.")
-
- if incorrect_subnet_cfg:
- sys.exit(2)
-
- except KeyboardInterrupt:
- logger.info("User canceled")
- sys.exit(4)
- except Exception, ex:
- logger.exception(ex)
- sys.exit(5)
- finally:
- if conn:
- conn.close()
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/bin/gpdebug
----------------------------------------------------------------------
diff --git a/tools/bin/gpdebug b/tools/bin/gpdebug
deleted file mode 100755
index e5e1d4a..0000000
--- a/tools/bin/gpdebug
+++ /dev/null
@@ -1,382 +0,0 @@
-#!/usr/bin/env python
-# Line too long - pylint: disable=C0301
-# Invalid name - pylint: disable=C0103
-
-"""
- gpdebug
- Copyright (c) EMC/Greenplum Inc 2011. All Rights Reserved.
-"""
-import os, signal, time
-
-from psi import AttrInsufficientPrivsError
-from psi.process import Process, ProcessTable, NoSuchProcessError
-
-from gppylib import gplog, pgconf
-from gppylib.db import dbconn
-from gppylib.gparray import get_segment_hosts, get_session_ids
-from gppylib.mainUtils import YamlMain, Exit
-from gppylib.commands import gp
-from gppylib.commands.unix import check_pid
-from gppylib.commands.base import run_remote_commands, Command
-from gppylib.gp_era import read_era
-from gppylib.util.ssh_utils import get_hosts
-from gppylib.utils import TableLogger
-
-
-class GpDebugMain(YamlMain):
- """
- Main class for the gpdebug utility. The yaml document below specifies
-
- * how command line options are parsed
- * expected execution scenarios
- * expected error conditions and messages
-
- %YAML 1.1
- ---
-
- #
- # arguments
- #
- Usage: 'usage: %prog [options]'
- Description: Investigate processes
- Options:
- Groups:
- - Help Options
- - Logging Options
- - Connection Options
- - Troubleshooting Options
- - Orphan Options
-
- Help Options:
- -h,-?,--help,--usage:
- help: Show help message and exit.
- action: help
- Logging Options:
- -q: Quiet Mode - only show problems on stdout
- -v: Verbose Mode - include verbose debugging information
- Connection Options:
- -d,--master_data_directory:
- type: string
- dest: masterDataDirectory
- metavar: 'MASTERDATADIR'
- help: |
- Optional. The master host data directory.
- If not specified, the value set for $MASTER_DATA_DIRECTORY will be used.
- Troubleshooting Options:
- --pid:
- help: Capture Troubleshooting information for specified process.
- action: store_const
- dest: scenario
- const: Capture Troubleshooting Information
- Orphan Options:
- -f:
- help: Hosts file
- type: string
- dest: hostsfile
- -o:
- help: Output file with details and gpkill commands
- type: string
- dest: outputfile
- --orphans:
- help: Search cluster for orphan processes
- action: store_const
- dest: scenario
- const: Check Cluster For Orphans
- --all:
- help: Count system processes as orphans
- action: store_true
- --detailed:
- help: Report orphan details
- action: store_true
-
- # gpdebug --orphans remotely executes gpdebug --orphans-host
- # on each segment host with additional --era and --datadir parameters.
- # note that --datadir may occur multiple times
-
- --orphans-host:
- help: hidden - Check host for orphan processes
- action: store_const
- dest: scenario
- const: Check Host For Orphans
- --host:
- help: hidden - Current host
- type: string
- dest: host
- --era:
- help: hidden - Current master era (or None)
- type: string
- dest: era
- --datadir:
- help: hidden - segment data directory
- type: string
- action: append
- dest: dirlist
- --sessid:
- help: hidden - session id
- type: string
- action: append
- dest: sessionids
-
- #
- # scenarios
- #
- Default Scenario: Capture Troubleshooting Information
-
- Scenarios:
- Capture Troubleshooting Information:
- - 1. On Current Host:
- - 1.1. Validate PID
- - 1.2. Troubleshoot Process
-
- Check Cluster For Orphans:
- - 1. On Current Host:
- - 1.1. Identify Master
- - 1.2. Identify Segments
- - 1.3. Identify Sessions
- - 1.4. Identify Current Era
- - 1.5. Search for Orphans
- - 1.6. Report Results
- - 1.7. Generate Output File
-
- Check Host For Orphans:
- - 1. On Current Host:
- - 1.1. Identify Orphans
- - 1.2. Return Orphan Details
-
- Errors:
- nopid: 'no pid specified, consider --help'
- badpid: 'invalid pid: %(pid)s'
- get_segment_hosts: 'Unable to read hosts from master. Please investigate or consider -f hostfile option.'
- """
-
-
- # GpDebugMain constructor
- #
- def __init__(self):
- "Here we go..."
- YamlMain.__init__(self)
-
- # generic state set by YamlMain.run() we also set here mainly to make code clearer
- #
- self.scenario_name = None # what we call what we're doing, e.g. 'Examine Process'
- self.plan = None # plan object built from the yaml above
- self.logger = None # helpful logger object reference
- self.errmsg = None # helpful errmsg function reference
-
- # additional state we update during execution
- self.pid = None # pid
-
- # Orphans (master host)
- self.master_datadir = None # master data directory
- self.master_port = None # master port
- self.host_list = None # list of hosts
- self.era = None # master era
- self.results = None # execution results
-
- # Orphans (segment)
- self.orphans = None
-
-
- #
- # Scenario: Capture Troubleshooting Information
- #
-
- def validate_pid(self):
- ""
-
- # user has to give us an argument
- if len(self.args) != 1:
- raise Exit(1, 'nopid')
-
- # the argument had better be a valid integer
- pid = self.args[0]
- try:
- self.pid = int(pid)
- except (ValueError), e:
- raise Exit(1,'badpid')
-
-
- def troubleshoot_process(self):
- ""
-
- # use glider to capture the stack of the target process.
- # we run it from a shell with an explicit ulimit to prevent
- # this from taking too long (occasionally observed on osx).
- #
- pid = self.pid
- shcmd = 'ulimit -t 4; $GPHOME/sbin/glider %(pid)s' % locals()
- command = Command('Troubleshooting', shcmd)
-
- self.logger.info(command)
- command.run(validateAfter = False)
-
- # log whatever output we get, stderr as error and stdout as info
- #
- for line in command.get_stderr_lines():
- self.logger.info(line)
- for line in command.get_stdout_lines():
- self.logger.info(line)
-
-
- #
- # Scenario: Check Cluster For Orphans (master host)
- #
-
- def identify_master(self):
- ""
- self.master_datadir = self.options.masterDataDirectory or gp.get_masterdatadir()
- self.master_port = gp.get_masterport(self.master_datadir)
-
- def identify_segments(self):
- ""
- if self.options.hostsfile:
- self.hosts_list = get_hosts(self.options.hostsfile)
- else:
- self.hosts_list = get_segment_hosts(self.master_port)
-
-
- def identify_sessions(self):
- ""
- if self.options.hostsfile:
- self.session_ids = set()
- else:
- self.session_ids = get_session_ids(self.master_port)
-
- for sess_id in self.session_ids:
- self.logger.info('session id: %s' % sess_id)
-
-
- def identify_current_era(self):
- ""
- self.era = read_era(self.master_datadir, self.logger)
-
- def search_for_orphans(self):
- ""
- commands = {}
- for host in self.hosts_list:
- cmdlist = [
- '$GPHOME/bin/gpdebug',
- '-q',
- '--orphans-host',
- '--era', str(self.era),
- '--host', str(host)
- ]
- if self.options.all:
- cmdlist.append('--all')
- if self.options.detailed:
- cmdlist.append('--detailed')
- for s in self.session_ids:
- cmdlist.append('--sessid')
- cmdlist.append(str(s))
-
- commands[host] = " ".join(cmdlist)
-
- cmds = run_remote_commands('Search for Orphans', commands)
- self.results = {}
- for host, cmd in cmds.items():
- self.results[host] = cmd.get_stdout_lines()
-
-
- def report_results(self):
- ""
- for host, lines in self.results.items():
- if len(lines) < 1:
- self.logger.info('no orphans observed on %s' % host)
- continue
- self.logger.info('found %d orphans on %s' % (len(lines), host))
-
-
- # --detailed output
- #
- if self.options.detailed:
- tabLog = None
- for host, lines in self.results.items():
- prev = None
- for line in lines:
- host2, era, sessid, pid, detail = line.split('|')
- assert host == host2
- if era != prev:
- if tabLog:
- self.logger.info("Era: %s" % prev)
- tabLog.outputTable()
- self.logger.info("--------------------------------------------")
- tabLog = TableLogger()
- tabLog.info(["Host","SessId","Pid","Detail"])
- prev = era
- tabLog.info([host, sessid, pid, detail])
- if tabLog:
- self.logger.info("Era: %s" % prev)
- tabLog.outputTable()
- self.logger.info("--------------------------------------------")
-
-
- def generate_output_file(self):
- ""
- if self.options.outputfile is None:
- return
-
- self.logger.info('writing gpkill script to %s' % self.options.outputfile)
-
- with open(self.options.outputfile, 'w') as f:
- for host, lines in self.results.items():
- prev = None
- for line in lines:
- host2, era, sessid, pid, detail = line.split('|')
- assert host == host2
- if era != prev:
- f.write('# era %s\n' % era)
- prev = era
- f.write('# sessid %s\n' % sessid)
- f.write('# %s\n' % detail)
- f.write('gpssh -h %s gpkill %s\n\n' % (host, pid))
-
-
- #
- # Scenario: Check Host For Orphans (segment hosts, via search for orphans)
- #
-
- def identify_orphans(self):
- ""
- self.logger.info("Era: %s" % self.options.era)
- self.orphans = []
- for p in ProcessTable().values():
- try:
- d = dict(p.env)
- except AttrInsufficientPrivsError:
- continue
- e = d.get('GPERA')
- s = d.get('GPSESSID')
-
- # look for processes from another era
-
- if e is None:
- continue
- if e != self.options.era:
- self.orphans.append((e, s, str(p.pid), p.command.strip()))
- continue
-
- # look for process in same era with a session id not in
- # the list of session ids known to the master
-
- if s is None:
- continue
- s = str(int(s)) # convert 0000000024 -> 24
-
- # report all processes when --all is specified
- # otherwise only show nonzero sessions not known at the master
- #
- if not self.options.all:
- if s == '0' or s in (self.options.sessionids or []):
- continue
-
- self.orphans.append((e, s, str(p.pid), p.command.strip()))
-
- def return_orphan_details(self):
- ""
- for era, sessid, pid, command in self.orphans:
- result = "|".join([ self.options.host, era, sessid, pid, command ])
- print result
-
-
-if __name__ == '__main__':
- GpDebugMain().simple()
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/bin/gpdetective
----------------------------------------------------------------------
diff --git a/tools/bin/gpdetective b/tools/bin/gpdetective
deleted file mode 100755
index d336391..0000000
--- a/tools/bin/gpdetective
+++ /dev/null
@@ -1,1288 +0,0 @@
-#!/usr/bin/env python
-'''
-Usage: gpdetective <option> [dbname]
-
- -? : Print usage and exit
- -v : Print version and exit
- -h host : DB host name
- -p port : DB port number
- -P passwd : DB password
- -U uname : DB User Name
-
- --start_date=number : Log start date (number of days ago)
- --start_date="YYYY-MM-DD" : Log start date (explicit date)
- --end_date="YYYY-MM-DD" : Log end date (ends at 00:00:00 on end_date)
-
- --diagnostics=a[ll],n[one],s[tate],o[s],c[atalog]
- : Defines which diagnostics to run (default is "all")
-
- --logs=a[ll],n[none,<list>
- : Defines the list of segment log file dbid's to retrieve
- a[ll] = all segments and mirrors (the default)
- n[one] = no segments and mirrors
- <list> = [n | n-m[,n | n-m]...] where n and m are integers. (e.g. 0,1-4,8,11)
-
- --pg_changetracking_logs=a[ll],n[none,<list>
- : Defines the list of segment pg_changetracking log file dbid's to retrieve
- a[ll] = all segments and mirrors
- n[one] = no segments and mirrors (the default)
- <list> = [n | n-m[,n | n-m]...] where n and m are integers. (e.g. 0,1-4,8,11)
-
- --core=t[rue]|f[alse]
- : Determines whether or not core files are retrieved (default is true).
-
- --pg_dumpall=t[rue]|f[alse]
- : Option to run pg_dumpall (default is true)
-
- --pg_dump_options="<options>"
- : A list of valid pg_dump options (e.g. "-t public.table1 database1")
-
- --tempdir="temp dir"
- : Temporary directory used by gpdetective
- The default is determined by the $TEMP, $TMP and $TMPDIR environment variables.
-
- --connect=t[rue]|f[alse]
- : If connect is false, then retrieve only information that can be
- obtained without making a connection to the database (default is true).
-
-'''
-#============================================================
-import sys, os, tempfile, subprocess, re, getopt, types, traceback, datetime
-from gppylib.gpcoverage import GpCoverage
-from gppylib.operations.filespace import GP_TRANSACTION_FILES_FILESPACE, GP_TEMPORARY_FILES_FILESPACE
-
-libdir = sys.path[0] + '/lib'
-try:
- from pygresql import pg
-except Exception, e:
- sys.exit('Error: unable to import the PyGreSQL Python module module: ' + str(e))
-
-
-GPHOME=os.environ.get('GPHOME')
-SRC_GPPATH=". %s/greenplum_path.sh;" % GPHOME
-
-#============================================================
-def pretty_version(v):
- '''
- Turns the RCS revision number into a prettier format
- '''
- m = re.compile('Revision: #(\d+)').search(v)
- if m: return str((float(m.group(1))+100)/100)
- else: return str(v)
-__version__ = pretty_version('$Revision$')
-
-#============================================================
-def usage(exitarg = None):
- '''
- Print usage information and exit
- '''
- print cli_help() or __doc__
- sys.exit(exitarg)
-
-#============================================================
-def cli_help():
- progname=os.path.split(__file__)[-1]
- help_path = os.path.join(sys.path[0], '..', 'docs', 'cli_help', progname + '_help');
- f = None
- try:
- try:
- f = open(help_path);
- return f.read(-1)
- except:
- return ''
- finally:
- if f: f.close()
-
-#============================================================
-def which (filename):
- if not os.environ.has_key('PATH') or os.environ['PATH'] == '':
- p = os.defpath
- else:
- p = os.environ['PATH']
-
- pathlist = p.split (os.pathsep)
-
- for path in pathlist:
- f = os.path.join(path, filename)
- if os.access(f, os.X_OK):
- return f
- return None
-
-#============================================================
-def truth (option, val):
- if val.lower() == 't' or val.lower() == 'true':
- return True
- elif val.lower() == 'f' or val.lower() == 'false':
- return False
- else:
- usage('Error: Invalid option for %s: %s' % (option, val))
-
-
-#============================================================
-class GPDetective:
- '''
- GPDetecive main class
- '''
- opt = {} # Command line options
- db = 'postgres' # Default database
- master = None # Database connection to master
- olddir = None # Directory script was executed from
- logdir = None # Temporary directory
- errlog = None # Error log
- tardir = None # name of the produced tarball
- error = None
- start_date = None
- end_date = None
- log_list = [] # [] implies all segments (the default)
- pg_changetracking_log_list = None # None implies no segments (the default)
- pg_dump_options = None
- rungpstate = True
- runpg_dumpall = True
- rungpcheckos = True
- rungpcheckcat = True
- runcore = True
- runconnected = True
-
- # Configuration information
- tempdir = None # Temporary directory for gathering information
- masterdir = None # Master Directory, assumed on this host
- backupmasterhostdir = None # backup (mirror) Master Directory
- backupmasterhostname = None # backup (mirror) Master host name
- hosts = [] # list of all segment hosts
- segments = [] # list of all segments (tuple with "dbid" and "hostname:datadir")
- mirrors = [] # list of all mirror segments (tuple with "dbid" and "hostname:datadir")
- databases = [] # list of all databases (except template)
-
- #------------------------------------------------------------
- def __init__(self):
- '''
- Initialize the Greenplum Detective
- 1) Extract command line arguments
- 2) Establish connection to master database
- 3) Create Logging Directory
- 4) Create error file
- '''
- self.olddir = os.getcwd()
- if not os.access('.', os.W_OK):
- sys.exit("No write permission to current directory")
-
- # Get default option values from enviornment
- self.opt = {
- '-h': os.environ.get('PGHOST') or 'localhost',
- '-P': os.environ.get('PGPASSWORD'),
- '-U': os.environ.get('USER'),
- '-p': os.environ.get('PGPORT'),
- }
-
- # Override defaults based on command line options
- try:
- (options, args) = getopt.getopt(sys.argv[1:],
- '?h:p:P:U:vV',
- [ 'version'
- , 'start_date='
- , 'end_date='
- , 'connect='
- , 'pg_dump_options='
- , 'tempdir='
- , 'diagnostics='
- , 'logs='
- , 'pg_changetracking_logs='
- , 'pg_dumpall='
- , 'cores='
- ])
- for (switch, val) in options:
- if switch == '-?': usage(0)
- if switch[1] in 'vV' or switch == '--version':
- print 'gpdetective ' + __version__
- sys.exit(0)
- elif switch == '--connect':
- self.runconnected = truth(switch, val)
- elif switch == '--start_date':
- self.start_date = val
- elif switch == '--end_date':
- self.end_date = val
- elif switch == '--pg_dump_options':
- self.pg_dump_options = val
- elif switch == '--tempdir':
- self.tempdir = val
- elif switch == '--diagnostics':
- self.handleDiagnosticParameterList(val)
- elif switch == '--logs':
- self.log_list = self.handleSegmentParameterList(val)
- elif switch == '--pg_changetracking_logs':
- self.pg_changetracking_log_list = self.handleSegmentParameterList(val)
- elif switch == '--pg_dumpall':
- self.runpg_dumpall = truth(switch, val)
- elif switch == '--cores':
- self.runcore = truth(switch, val)
- elif switch[1] in 'hpPU':
- self.opt[switch] = val
- except Exception, e:
- usage('Error: ' + str(e))
-
- # Before we go calling psql, we should check the path to ensure
- # that we have everything we need.
- self.checkPath();
-
- # If still no default port, resort to other methods
- if not self.opt['-p']:
- psql = subprocess.Popen(['psql', '-?'], stdout=subprocess.PIPE)
- port = subprocess.Popen(['grep', 'PORT'], stdin=psql.stdout,
- stdout=subprocess.PIPE)
- line = port.communicate()[0]
- port_re = re.compile('default: "(\d+)"')
- m = port_re.search(line)
- if not m: exit('Error: Could not determine PORT')
- self.opt['-p'] = m.group(1)
-
- # Make sure port is actually an integer
- try: self.opt['-p'] = int(self.opt['-p'])
- except ValueError: exit('Error: Could not determine PORT')
-
- # Connect to master
- if self.runconnected == True:
- try:
- self.master = self.connect(db=self.db, utility=True)
- except:
- print "Error: Could not connect to the master database:",
- print " %s@%s:%s" % (self.opt['-U'], self.opt['-h'], self.opt['-p'])
- print "Please specify the correct host or start the master in admin mode."
- print "You may also run gpdetective in un-connected mode (i.e. --connect=false)."
- exit(1)
-
- # Setup the log directory
- self.mklogdir()
- self.errlog = open('error.log', 'w')
- self.errlog.write('gpdetective version ' + __version__ + '\n')
- self.errlog.flush()
- print 'Collecting information'
- self.getConfiguration()
-
-
- #------------------------------------------------------------
-
- def finishup(self):
- '''
- Cleanup open connections and remove temporary files
- '''
- if self.logdir:
- try: self.makeTar()
- except Exception, e: print str(e)
- if self.olddir: os.chdir(self.olddir)
- if self.master: self.master.close()
- if self.errlog: self.errlog.close()
- if self.logdir: subprocess.call(['rm', '-rf', self.logdir])
- if self.error:
- try:
- raise self.error
- except Exception, e:
- print "Internal error: " + str(e)
- print " details: %s" % traceback.format_exc()
- print "Aborting"
- else:
- print "Done"
-
-
- #------------------------------------------------------------
- def handleDiagnosticParameterList(self, diagnostics):
- '''
- All diagnostics are done by default.
- If the user specifies option(s), then all diagnostic options are set
- to false (i.e. not done), and individual diagnostics are are set to
- true (i.e. turned on) if the user specified their corresponding option.
- '''
- if diagnostics == None:
- usage('Error: Missing diagnostic options.')
-
- diagnosticsNoSpaces = diagnostics.replace(' ', '')
- diagList = diagnosticsNoSpaces.split(',')
- if len(diagList) == 1:
- if diagList[0] == 'a' or diagList[0] == 'all':
- # One diagnostic 'all' implies all diagnostics (the defalut)
- return
- elif diagList[0] == 'n' or diagList[0] == 'none':
- # One diagnostic 'none' implies turn off everyting.
- self.rungpstate = False
- self.rungpcheckos = False
- self.rungpcheckcat = False
- return
-
- # If we got this far, turn everything off.
- self.rungpstate = False
- self.rungpcheckos = False
- self.rungpcheckcat = False
-
- # Go through the list, and selectively turn on the corresponding diagnostic
- for diag in diagList:
- if diag == 'a' or diag == 'all' or diag == 'n' or diag == 'none':
- usage('Error: "%s" must be only diagnostics option.' % diag)
- elif diag == 's' or diag == 'state':
- self.rungpstate = True
- elif diag == 'o' or diag == 'os':
- self.rungpcheckos = True
- elif diag == 'c' or diag == 'catalog':
- self.rungpcheckcat = True
- else:
- usage('Error: Unrecognized diagnostic option: %s' % diag)
-
-
- #------------------------------------------------------------
- def handleSegmentParameterList(self, segs):
- '''
- The segs parameter is of the form
- a[ll]
- n[one]
- [n | n-m[,n | n-m]...] where n and m are integers.
-
- return
- [] implies all segments
- None implies no segments
- A list of integers that correspond to the list of entries in segs.
- (e.g. segs = "1, 2, 5-10, 14". Return [1,2,5,6,7,8,9,10,14])
- If segs contains no segment numbers, then None
- '''
-
- returnValueList = None
- segsNoSpaces = ""
- inRange = False
- done = False
-
- if segs == None:
- usage('Error: Missing segs options.')
-
- segsNoSpaces = segs.replace(" ", "")
- segList = segsNoSpaces.split(',')
- if len(segList) == 1:
- if segList[0] == 'a' or segList[0] == 'all':
- returnValueList = []
- done = True
- elif segList[0] == 'n' or segList[0] == 'none':
- returnValueList = None
- done = True
-
- if done == False:
- returnValueList = []
- try:
- for element in segList:
- if element.isdigit() == True:
- returnValueList.append(int(element))
- else:
- subRange = element.split('-')
- for i in range(int(subRange[0]) , int(subRange[1]) + 1):
- returnValueList.append(i)
- except Exception, e:
- print 'Error in segment dbid list: ' + str(e)
- raise e
-
- return returnValueList
-
- #------------------------------------------------------------
- def checkPath(self):
- '''
- Ensures that we can find all the needed utilities used by
- the script.
- '''
- def cmdExists(cmd):
- if (not self.runCmd(['which', cmd])):
- sys.exit("Error: Could not find %s in path" % cmd)
- cmds = ['psql', 'ssh', 'scp', 'uname', 'ls', 'date', 'tar']
- map(cmdExists, cmds)
-
-
-
- #------------------------------------------------------------
- def connect(self, user=None, password=None, host=None, port=None, db=None, utility=False):
- '''
- Establish a connection to the Greenplum database
- '''
- user = user or self.opt['-U']
- password = password or self.opt['-P']
- host = host or self.opt['-h']
- port = port or self.opt['-p']
- db = db or self.opt['-U']
- if utility:
- options = '-c gp_session_role=utility'
- else:
- options = ''
- return pg.DB( dbname=db
- , host=host
- , port=port
- , user=user
- , passwd=password
- , opt=options
- )
-
-
- #------------------------------------------------------------
- def writeCmd(self, filename, cmd, childenv=None):
- '''
- Execute a shell command and dumps the results to the
- specified file.
-
- "cmd" can be a list or string.
-
- '''
- self.errlog.write('localhost$ ')
- for i in cmd: self.errlog.write(str(i) + ' ')
- self.errlog.write("\n")
- self.errlog.flush()
-
- if filename:
- file = open(filename, 'w')
- file.write('localhost$ ')
- if isinstance(cmd, str):
- file.write(cmd)
- else:
- for i in cmd: file.write(str(i) + ' ')
- file.write("\n")
- file.flush()
- else:
- file = self.errlog
- try:
- if isinstance(cmd, str):
- p = subprocess.Popen(cmd, stdout=file, shell=True, stderr=self.errlog, env=childenv)
- p.wait()
- else:
- subprocess.call(cmd, stdout=file, stderr=self.errlog, env=childenv)
- except Exception, e:
- self.errlog.write("Error: " + str(e) + "\n");
- self.errlog.flush()
-
- if filename:
- file.close()
-
- #------------------------------------------------------------
- def writeSelect(self, filename, queryStr):
- '''
- Execute a sql query and dump the results to the specified file.
-
- For formatting purposes it materializes the entire query in
- memory, so don't get out of hand!
- '''
- self.errlog.write('SQL: ' + queryStr + "\n")
- self.errlog.flush()
- results = None
-
- try:
- resultObject = self.master.query(queryStr)
- except Exception, e:
- self.errlog.write("Error: " + str(e) + "\n");
- self.errlog.flush()
- return
-
- d = resultObject.listfields()
- file = open(filename, 'w')
- file.write('SQL: ' + queryStr + "\n")
- file.flush()
-
- # In order to produce formatted output we need to scan through
- # all the data first before we output anything.
- width = map(lambda(x): len(x), d)
- data = []
- results = resultObject.getresult()
- for tuple in results:
- data.append(tuple)
- for column in d:
- index = resultObject.fieldnum(column)
- item = str(tuple[index])
- width[index] = max(width[index], len(item))
-
- # Now that we have calculated the width, output the result
- for column in d:
- index = resultObject.fieldnum(column)
- file.write(column.ljust(width[index]) + ' | ')
- file.write("\n")
- for column in d:
- index = resultObject.fieldnum(column)
- if (index > 0):
- file.write('-')
- file.write('-' * width[index] + '-+')
- file.write("\n")
- for tuple in data:
- for column in d:
- index = resultObject.fieldnum(column)
- file.write(str(tuple[index]).ljust(width[index]) + ' | ')
- file.write("\n")
- file.close()
-
-
- #------------------------------------------------------------
- def writeArray(self, filename, itemlist):
- '''
- Writes an array to a specified file
- '''
- file = open(filename, 'w')
- for item in itemlist:
- file.write(str(item) + "\n")
- file.close()
-
- #------------------------------------------------------------
- def select(self, queryStr):
- '''
- Execute a SQL query and return an array of result rows
- + Single columns will be returned as an array of values
- + Multiple columns will be returned as an array of tuples
- '''
- self.errlog.write('SQL: ' + queryStr + "\n")
- self.errlog.flush()
-
- rows = []
- resultObject = self.master.query(queryStr)
- results = resultObject.getresult()
- for tuple in results:
- if len(tuple) == 1:
- rows.append(tuple[0])
- else:
- rows.append(tuple)
- return rows
-
- #------------------------------------------------------------
- def runCmd(self, cmd, host=None):
- '''
- Execute a shell command and returns the results
- '''
- if not host:
- host = 'localhost'
-
- # For logging purposes get the string version of the command
- if isinstance(cmd, list):
- cmdstr = ''
- for c in cmd: cmdstr += c + ' '
- else:
- cmdstr = str(cmd)
-
- if (self.errlog):
- self.errlog.write('%s$ %s\n' % (host, cmdstr))
- self.errlog.flush()
- try:
- cmd = cmd.split(' ')
- except: pass
- if host != 'localhost':
- cmd.insert(0, 'ssh')
- cmd.insert(1, host)
-
- # A stupid hack to ignore unmatched globs in 'ls'
- if (cmd[0] == 'ls'):
- x = subprocess.Popen(cmd, stdout=subprocess.PIPE)
- else:
- x = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=self.errlog)
- return str(x.communicate()[0].strip())
-
- #------------------------------------------------------------
- def log(self, test):
- '''
- Logs the start of a test
- '''
- print ' + ' + test
- if (self.errlog):
- self.errlog.write('\nTEST: ' + test + '\n')
- self.errlog.flush()
-
-
- #------------------------------------------------------------
- def getConfiguration(self):
- '''
- Collect configuration information
- '''
- self.log('getConfiguration')
-
- os.mkdir('master')
-
- if self.runconnected == False:
- # Assume we are running on the master,
- # and try to get the location of the master directory
- self.opt['-h'] = self.runCmd('uname -n')
- self.masterdir = os.environ.get('MASTER_DATA_DIRECTORY')
- return
-
- os.mkdir('backupmaster')
-
- # Master directory
- rows = self.select(
- '''
- SELECT hostname, fselocation
- FROM gp_segment_configuration
- INNER JOIN pg_filespace_entry on (fsedbid=dbid)
- INNER JOIN pg_filespace fs on (fs.oid = fsefsoid and fsname = 'pg_system')
- WHERE content = -1 AND preferred_role = 'p'
- ''')
- self.opt['h'] = rows[0][0]
- self.masterdir = rows[0][1]
-
- # Backup (mirror) Master directory
- rows = self.select(
- '''
- SELECT hostname, fselocation
- FROM gp_segment_configuration
- INNER JOIN pg_filespace_entry on (fsedbid=dbid)
- INNER JOIN pg_filespace fs on (fs.oid = fsefsoid and fsname = 'pg_system')
- WHERE content < 0 AND preferred_role != 'p'
- ''')
- if len(rows) > 0:
- self.backupmasterhostname = rows[0][0]
- self.backupmasterhostdir = rows[0][1]
-
- # List of hosts
- self.hosts = self.select(
- '''
- SELECT distinct hostname
- FROM gp_segment_configuration
- WHERE content >= 0
- ''')
-
- # list of segments
- self.segments = self.select(
- '''
- SELECT dbid, hostname || ':' || fselocation
- FROM gp_segment_configuration
- INNER JOIN pg_filespace_entry on (fsedbid=dbid)
- INNER JOIN pg_filespace fs on (fs.oid = fsefsoid and fsname = 'pg_system')
- WHERE content >= 0 AND preferred_role = 'p'
- ''')
-
- # list of mirrors
- self.mirrors = self.select(
- '''
- SELECT dbid, hostname || ':' || fselocation
- FROM gp_segment_configuration
- INNER JOIN pg_filespace_entry on (fsedbid=dbid)
- INNER JOIN pg_filespace fs on (fs.oid = fsefsoid and fsname = 'pg_system')
- WHERE content >= 0 AND preferred_role != 'p'
- ''')
-
- # list of databases
- self.databases = self.select(
- '''
- SELECT datname FROM pg_database
- WHERE datname not in ('template0', 'template1')
- ''')
-
- self.writeArray('hosts', self.hosts)
- for host in self.hosts:
- os.mkdir(host)
- self.writeSelect('config.log',
- '''
- SELECT * from gp_segment_configuration
- ''')
-
- self.writeSelect('config_history.log',
- '''
- SELECT * from gp_configuration_history
- ''')
-
- self.writeSelect('config_history.log',
- '''
- SELECT * FROM gp_configuration_history
- ''')
-
- self.writeSelect('resqueue.log',
- '''
- SELECT * FROM pg_catalog.pg_resqueue
- ''')
-
- self.writeSelect('mastermirror.log',
- '''
- SELECT * FROM pg_catalog.gp_master_mirroring
- ''')
-
- self.writeSelect('version_at_initdb.log',
- '''
- SELECT * FROM pg_catalog.gp_version_at_initdb
- ''')
-
- self.writeSelect('interfaces.log',
- '''
- SELECT * FROM pg_catalog.gp_interfaces
- ''')
-
- self.writeSelect('db_interfaces.log',
- '''
- SELECT * FROM pg_catalog.gp_db_interfaces
- ''')
-
- self.writeSelect('autovacuum.log',
- '''
- SELECT * FROM pg_catalog.pg_autovacuum
- ''')
-
- self.writeSelect('pgdatabase.log',
- '''
- SELECT * FROM pg_catalog.gp_pgdatabase
- ''')
-
- self.writeSelect('dbsizes.log',
- '''
- SELECT datname,pg_size_pretty(pg_database_size( datname ))
- FROM ( SELECT datname
- FROM pg_database
- WHERE datname NOT IN ('template0', 'postgres')) d
- ''')
-
- self.writeSelect('pg_stat_resqueue.log',
- '''
- SELECT * FROM pg_catalog.pg_resqueue_status
- ''')
-
- self.writeSelect('pg_stat_database.log',
- '''
- SELECT * FROM pg_catalog.pg_stat_database
- ''')
-
- self.writeSelect('pg_roles.log',
- '''
- SELECT * FROM pg_catalog.pg_roles
- ''')
-
- self.writeSelect('pg_filespace.log',
- '''
- SELECT * FROM pg_catalog.pg_filespace
- ''')
-
- self.writeSelect('pg_filespace_entry.log',
- '''
- SELECT * FROM pg_catalog.pg_filespace_entry
- ''')
-
-
-
-
- #------------------------------------------------------------
- def get_timeopt(self):
- opt = ''
- if self.start_date:
- if self.start_date.find('-') == -1:
- start = datetime.date.today() - datetime.timedelta(days=int(self.start_date))
- opt = '--begin %s' % str(start)
- else:
- opt = '--begin %s' % self.start_date
- if self.end_date:
- opt = opt + ' --end %s' % self.end_date
- return opt
-
-
-
- #------------------------------------------------------------
- def grabMasterLog(self,masterlog,dst_file,time_opt):
- myfile = open(dst_file, 'w')
- cmd = '%s/gplogfilter --quiet %s %s' % (sys.path[0],time_opt,masterlog)
- p=subprocess.Popen(cmd, stdout=myfile,shell=True)
- p.wait()
- myfile.close()
- if p.returncode == 0:
- return True
- else:
- return False
-
-
- #------------------------------------------------------------
- def grabLog(self, hostname, loglocation, dst_file, time_opt):
- myfile = open(dst_file, 'w')
- try:
- cmdstr = "gplogfilter --quiet %s %s 2>&1" % (time_opt,loglocation)
- cmd="ssh %s \"%s %s\" " % (hostname,SRC_GPPATH,cmdstr)
- p = subprocess.Popen(cmd, stdout=myfile,shell=True)
- p.wait()
- if p.returncode == 0:
- found = True
- else:
- self.log('could not find the log on host: %s in dir: %s' % (hostname,loglocation))
- myfile.close()
- f = open(dst_file,'r')
- str=f.readlines()
- self.log('command returned: %s' % str)
- f.close()
- found = False
- except OSError, e:
- self.log('' + str(e))
- found = False
-
- myfile.close()
- return found
-
-
- #------------------------------------------------------------
- def copyLogs(self):
- '''
- 1. Copy logfiles from master and all segments
- 2. Copy postgresql.conf from master and all segments
- 3. Copy ~/gpAdminLogs from master.
- '''
- self.log('copyLogs')
-
- # Grab master log and postgresql.conf
- #
- path_re = re.compile('/([^/]*)$')
- m = path_re.search(self.masterdir)
-
- time_opt=self.get_timeopt()
- hostname=m.group(1)
-
- logfile= self.masterdir + '/pg_log/*'
- dst_file = 'master/%s_rotated.log' % hostname
- if not self.grabMasterLog(logfile,dst_file,time_opt):
- os.remove(dst_file)
-
- self.log(' get master logs')
- self.runCmd(['scp', '%s/postgresql.conf' % self.masterdir,
- 'master/postgresql.conf'])
- self.runCmd(['scp', '%s/global/pg_database' % self.masterdir,
- 'master/pg_database'])
- self.runCmd(['scp', '%s/global/pg_auth' % self.masterdir,
- 'master/pg_pgauth'])
-
-
- # Grab backup master log and postgresql.conf
- # host : fullpath / filename
- host_rx = re.compile('(.*)/([^/]*)')
- if self.runconnected == True and self.backupmasterhostdir != None and self.backupmasterhostname != None:
- m = host_rx.search(self.backupmasterhostdir)
- backupmaster_out_name='backupmaster/%s_rotated.log' % m.group(2)
- backupmasterlog = "%s/%s/pg_log/*" % m.group(1,2)
- if not self.grabLog( self.backupmasterhostname
- , backupmasterlog
- , backupmaster_out_name
- , time_opt
- ):
- os.remove(backupmaster_out_name)
-
- self.log(' get backup master logs')
- self.runCmd(['scp', '-q',
- '%s/postgresql.conf' % str(self.backupmasterhostname + ':' + self.backupmasterhostdir),
- 'backupmaster/postgresql_%s.conf' % m.group(2)])
-
-
- # Grab segment logs and postgresql.conf
- # host : fullpath / filename
- host_rx = re.compile('(.*)\:(.*)/([^/]*)')
- if self.log_list != None and self.runconnected == True:
- self.log(' get primary segment logs')
- for seg in self.segments:
- if self.log_list != [] and int(seg[0]) not in self.log_list:
- continue
- m = host_rx.search(seg[1])
- hostname = m.group(1)
- out_name='%s/%s_rotated.log' % (m.group(1,3))
- seglog = "%s/%s/pg_log/*" % m.group(2,3)
- if not self.grabLog(hostname,seglog,out_name,time_opt):
- os.remove(out_name)
- self.runCmd(['scp', '-q',
- '%s/postgresql.conf' % seg[1],
- '%s/postgresql_%s.conf' % m.group(1,3)])
-
- # Grab backup (mirror) segment logs and postgresql.conf
- # host : fullpath / filename
- host_rx = re.compile('(.*)\:(.*)/([^/]*)')
- if self.log_list != None and self.runconnected == True and len(self.mirrors) > 0:
- self.log(' get mirror segment logs')
- for mir in self.mirrors:
- if self.log_list != [] and int(mir[0]) not in self.log_list:
- continue
- m = host_rx.search(mir[1])
- hostname = m.group(1)
- out_name = '%s/%s_rotated_mirror.log' % (m.group(1,3))
- mirlog = "%s/%s/pg_log/*" % m.group(2,3)
- if not self.grabLog(hostname,mirlog,out_name,time_opt):
- os.remove(out_name)
- self.runCmd(['scp', '-q',
- '%s/postgresql.conf' % mir[1],
- '%s/postgresql_%s_mirror.conf' % m.group(1,3)])
-
- #3 grab gpAdminLogs
- adminLogsDir=os.path.expanduser("~") + "/gpAdminLogs/"
- self.log(' get gpAdminLogs')
- self.runCmd(['cp', '-R', adminLogsDir , 'master/gpAdminLogs'])
-
-
- # Grab segment pg_changetracking logs
- # host : fullpath / filename
- host_rx = re.compile('(.*)\:(.*)/([^/]*)')
- if self.pg_changetracking_log_list != None and self.runconnected == True:
- self.log(' get primary segment pg_changetracking logs')
- for seg in self.segments:
- if self.pg_changetracking_log_list != [] and int(seg[0]) not in self.pg_changetracking_log_list:
- continue
- m = host_rx.search(seg[1])
- hostname = m.group(1)
- tempStr = self.runCmd(['scp', '-qr',
- '%s/pg_changetracking' % seg[1],
- '%s/pg_changetracking_%s' % m.group(1,3)])
- elif self.runconnected == True:
- # We still want to get some of the log files.
- self.log(' get primary segment pg_changetracking FILEREP_CONFIG_LOG and FILEREP_LOG logs')
- for seg in self.segments:
- m = host_rx.search(seg[1])
- hostname = m.group(1)
- tempStr = self.runCmd(['mkdir', '%s/pg_changetracking_%s' % m.group(1,3)])
- tempStr = self.runCmd(['scp', '-qr',
- '%s/pg_changetracking/FILEREP_CONFIG_LOG' % seg[1],
- '%s/pg_changetracking_%s/FILEREP_CONFIG_LOG' % m.group(1,3)])
- tempStr = self.runCmd(['scp', '-qr',
- '%s/pg_changetracking/FILEREP_LOG' % seg[1],
- '%s/pg_changetracking_%s/FILEREP_LOG' % m.group(1,3)])
-
- # Grab backup (mirror) pg_changetracking logs
- # host : fullpath / filename
- host_rx = re.compile('(.*)\:(.*)/([^/]*)')
- if self.pg_changetracking_log_list != None and self.runconnected == True and len(self.mirrors) > 0:
- self.log(' get mirror segment pg_changetracking logs')
- for mir in self.mirrors:
- if self.pg_changetracking_log_list != [] and int(mir[0]) not in self.pg_changetracking_log_list:
- continue
- m = host_rx.search(mir[1])
- hostname = m.group(1)
- tempStr = self.runCmd(['scp', '-qr',
- '%s/pg_changetracking' % mir[1],
- '%s/pg_changetracking_%s_mirror' % m.group(1,3)])
- elif self.runconnected == True:
- # We still want to get some of the log files.
- self.log(' get mirror segment pg_changetracking FILEREP_CONFIG_LOG and FILEREP_LOG logs')
- for mir in self.mirrors:
- m = host_rx.search(mir[1])
- hostname = m.group(1)
- tempStr = self.runCmd(['mkdir', '%s/pg_changetracking_%s_mirror' % m.group(1,3)])
- tempStr = self.runCmd(['scp', '-qr',
- '%s/pg_changetracking/FILEREP_CONFIG_LOG' % mir[1],
- '%s/pg_changetracking_%s_mirror/FILEREP_CONFIG_LOG' % m.group(1,3)])
- tempStr = self.runCmd(['scp', '-qr',
- '%s/pg_changetracking/FILEREP_LOG' % mir[1],
- '%s/pg_changetracking_%s_mirror/FILEREP_LOG' % m.group(1,3)])
-
- #------------------------------------------------------------
- def filespaceFlatFiles(self):
- """
- Copy the flat files for temporary/transaction filespaces
- from all the segments, master and standby.
- """
-
- #Copy files from primaries
- host_rx = re.compile('(.*)\:(.*)/([^/]*)')
- for seg in self.segments:
- m = host_rx.search(seg[1])
- tempStr = self.runCmd(['scp', '-qr',
- '%s/%s' % (seg[1], GP_TRANSACTION_FILES_FILESPACE),
- '%s/pg_changetracking_%s/%s' % (m.group(1), m.group(3), GP_TRANSACTION_FILES_FILESPACE)])
-
- tempStr = self.runCmd(['scp', '-qr',
- '%s/%s' % (seg[1], GP_TEMPORARY_FILES_FILESPACE),
- '%s/pg_changetracking_%s/%s' % (m.group(1), m.group(3), GP_TEMPORARY_FILES_FILESPACE)])
-
- #Copy files from mirrors
- for seg in self.mirrors:
- m = host_rx.search(seg[1])
- tempStr = self.runCmd(['scp', '-qr',
- '%s/%s' % (seg[1], GP_TRANSACTION_FILES_FILESPACE),
- '%s/pg_changetracking_%s_mirror/%s' % (m.group(1), m.group(3), GP_TRANSACTION_FILES_FILESPACE)])
-
- tempStr = self.runCmd(['scp', '-qr',
- '%s/%s' % (seg[1], GP_TEMPORARY_FILES_FILESPACE),
- '%s/pg_changetracking_%s_mirror/%s' % (m.group(1), m.group(3), GP_TEMPORARY_FILES_FILESPACE)])
-
- #Copy files from backupmaster
- host_rx = re.compile('(.*)/([^/]*)')
- if self.backupmasterhostdir is not None and self.backupmasterhostname is not None:
- m = host_rx.search(self.backupmasterhostdir)
- tempStr = self.runCmd(['scp', '-q',
- '%s/%s' % (self.backupmasterhostname + ':' + self.backupmasterhostdir,
- GP_TRANSACTION_FILES_FILESPACE),
- '%s/%s' % (m.group(1), GP_TRANSACTION_FILES_FILESPACE)])
- tempStr = self.runCmd(['scp', '-q',
- '%s/%s' % (self.backupmasterhostname + ':' + self.backupmasterhostdir,
- GP_TEMPORARY_FILES_FILESPACE),
- '%s/%s' % (m.group(1), GP_TEMPORARY_FILES_FILESPACE)])
-
- #Copy files from the master
- tempStr = self.runCmd(['cp', '%s/%s' % (self.masterdir, GP_TRANSACTION_FILES_FILESPACE),
- 'master/%s' % (GP_TRANSACTION_FILES_FILESPACE)])
- tempStr = self.runCmd(['cp', '%s/%s' % (self.masterdir, GP_TEMPORARY_FILES_FILESPACE),
- 'master/%s' % (GP_TEMPORARY_FILES_FILESPACE)])
-
- #------------------------------------------------------------
- def systemInfo(self):
- '''
- 1. Run gpstate
- 2. Run gpcheckos
- '''
- self.log('systemInfo')
-
- if self.rungpstate == True and self.runconnected == True:
- self.writeCmd('gpstate_mirrors.log', ['gpstate', '-m'])
- self.writeCmd('gpstate_standby_master.log', ['gpstate', '-f'])
-# self.writeCmd('gpstate_master.log',
-# ['gpstate', '-d', self.masterdir])
-
- if self.rungpcheckos == True:
- self.writeCmd('gpcheckos_master.log',
- ['gpcheckos', '-vm', '-h', self.opt['-h']])
- if self.runconnected == True:
- self.writeCmd('gpcheckos_segments.log',
- ['gpcheckos', '-vf', 'hosts'])
-
-
- #------------------------------------------------------------
- def checkCatalog(self):
- '''
- 1. Run gpcheckcat
- 2. pg_dump all databases or pg_dump using command specified in pg_dump_options
- 3. Run other catalog queries
- '''
- self.log('checkCatalog')
-
- checkcat = [libdir + '/gpcheckcat']
- if self.opt['-h']: checkcat.extend(['-h', str(self.opt['-h'])])
- if self.opt['-p']: checkcat.extend(['-p', str(self.opt['-p'])])
- if self.opt['-U']: checkcat.extend(['-U', str(self.opt['-U'])])
- if self.opt['-P']: checkcat.extend(['-P', str(self.opt['-P'])])
-
- if self.rungpcheckcat == True:
- for db in self.databases:
- checkcat.append(db)
- self.writeCmd('gpcheckcat_' + db + '.log', checkcat)
- checkcat.pop()
-
- conOpts = ""
- if self.opt['-h']:
- conOpts = conOpts + ' -h ' + str(self.opt['-h'])
- if self.opt['-p']:
- conOpts = conOpts + ' -p ' + str(self.opt['-p'])
- if self.opt['-U']:
- conOpts = conOpts + ' -U ' + str(self.opt['-U'])
-
- # if -P specified, put password into PGPASSWORD environment
- # for child pg_dumpall/pg_dump processes.
- childenv = None
- if self.opt['-P']:
- childenv = dict(os.environ)
- childenv['PGPASSWORD'] = self.opt['-P']
-
- if self.runpg_dumpall == True and self.pg_dump_options == None:
- self.log('pg_dumpall')
- self.writeCmd( 'pg_dumpall.log',
- 'pg_dumpall' + ' --schema-only' + ' --gp-syntax' + conOpts,
- childenv
- );
- if self.pg_dump_options != None:
- self.log('pd_dump')
- self.writeCmd( 'pg_dump.log'
- , 'pg_dump' + ' --schema-only' + ' --gp-syntax ' + self.pg_dump_options + conOpts
- , childenv
- );
-
- self.writeSelect('catalog_q1.log',
- '''
- SELECT
- nspname || '.' || relname,
- attname,
- starelid,
- staattnum,
- stanullfrac,
- stawidth,
- stadistinct,
- stakind1,
- stakind2,
- stakind3,
- stakind4,
- staop1,
- staop2,
- staop3,
- staop4,
- array_to_string(stanumbers1, ','),
- array_to_string(stanumbers2, ','),
- array_to_string(stanumbers3, ','),
- array_to_string(stanumbers4, ','),
- array_to_string(stavalues1, ','),
- array_to_string(stavalues2, ','),
- array_to_string(stavalues3, ','),
- array_to_string(stavalues4, ',')
- FROM pg_class c,
- pg_namespace n,
- pg_attribute a,
- pg_statistic s
- WHERE n.oid = c.relnamespace
- AND c.oid = a.attrelid
- AND c.oid = s.starelid
- AND a.attnum = s.staattnum
- ORDER BY 1, 2
- ''')
-
-
- #------------------------------------------------------------
- def crashReport(self):
- '''
- Find core files and extract useful information
- + Stack Traces
- + Local variables of current stack frame
- + Offending statement
- '''
- self.log('crashReport')
-
- path_re = re.compile('(.*/)?([^/]*)')
- core_re = re.compile('^Core was generated by .*postgres')
-
- # If master isn't in the list of hosts, add it in
- hosts = set(self.hosts).union([self.opt['-h']])
-
- for host in hosts:
- print " + " + host
- system = self.runCmd('uname', host)
- cores = [];
-
- if system == 'Darwin':
- # For OSX copy the CrashReporter files, these should exist even
- # if no core files were generated; this assumes we are running
- # as the user that started postgres.
- cr = host + ':~/Library/Logs/CrashReporter/postgres*'
- crlogs = self.runCmd(['scp', cr, host])
- core_pattern = self.runCmd(['/usr/sbin/sysctl', '-n',
- 'kern.corefile'], host)
-
- elif system == 'Linux':
- core_pattern = self.runCmd(['/sbin/sysctl', '-n',
- 'kernel.core_pattern'], host)
- if self.runCmd(['/sbin/sysctl', '-n',
- 'kernel.core_uses_pid'], host):
- core_pattern = core_pattern + '*'
-
- elif system == 'SunOS':
- init_pattern = self.runCmd(['grep', 'COREADM_INIT_PATTERN',
- '/etc/coreadm.conf'], host)
- core_pattern = init_pattern.split('=')[1]
-
- else:
- self.log('Crash Report - Unknown System: ' + system)
- self.writeArray('crash_report.log',
- ['Unknown system: ' + system])
- continue
-
-
- # Make replacements in core_pattern
- m = path_re.search(core_pattern)
- core_path = m.group(1) or ''
- core_pattern = m.group(2)
- core_pattern = re.sub(re.compile('\%[hH]'), host,
- core_pattern)
- core_pattern = re.sub(re.compile('\%[eE]'), 'postgres',
- core_pattern)
- core_pattern = re.sub(re.compile('\%.'), '*', core_pattern)
-
- # If the pattern is a full path then all the core files are
- # conviently in one place for this host. Otherwise we need
- # to go searching
- if len(core_path) > 0:
- cores = self.runCmd('ls -1 ' + core_path + core_pattern, host)
- cores = cores.split('\n')
-
- # If there are no cores, we end up with a list with one empty item. Remove it.
- if '' in cores:
- cores.remove('')
- else:
- # cores inconvienently dumped into process directory,
- # so go look in the relevant locations
- dir = ''
- if host == self.opt['-h']:
- dir = '%s %s/%s' % (dir, self.masterdir, core_pattern)
-
- for seg in self.segments:
- (shost, sdir) = seg[1].split(':')
- if shost == host:
- dir = '%s %s/%s' % (dir, sdir, core_pattern)
- for seg in self.mirrors:
- (shost, sdir) = seg[1].split(':')
- if shost == host:
- dir = '%s %s/%s' % (dir, sdir, core_pattern)
- cores = self.runCmd('ls -1 ' + dir, host)
- cores = cores.split('\n')
- # If there are no cores, we end up with a list with one empty item. Remove it.
- if '' in cores:
- cores.remove('')
-
- gdb = which('gdb');
- if (gdb == None):
- self.log(' No debugger found');
- self.writeArray(' Core files: ', cores)
- return
-
- def is_pgcore(c):
- corecheck = self.runCmd('%s -batch -n -c %s'
- % (gdb, str(c)),
- host)
- return core_re.search(corecheck)
- cores = filter(is_pgcore, cores)
-
- for corefile in cores:
- name = re.sub('/', '_', corefile)
- dbgout = self.runCmd([gdb, '--batch', '-n', '-c', corefile,
- '-x', libdir + '/crashreport.gdb',
- sys.path[0] + '/postgres'], host)
- if host in self.hosts:
- self.writeArray('%s/core%s' % (host, name), [dbgout])
- else:
- self.writeArray('master/core%s' % name, [dbgout])
-
- #------------------------------------------------------------
- def mklogdir(self):
- '''
- Creates the temporary directory and cds to that location
- '''
- self.logdir = tempfile.mkdtemp(dir=self.tempdir)
- os.chdir(self.logdir)
- timestamp = self.runCmd('date +%Y%m%d%H%M%S')
- self.tardir = 'gpdetective' + timestamp.strip()
- os.mkdir(self.tardir)
- os.chdir(self.tardir)
-
-
- #------------------------------------------------------------
- def makeTar(self):
- '''
- Creates a tar archive from the files in the temporary logdir
- '''
- self.log('makeTar')
- self.errlog.close();
- self.errlog = None
- os.chdir(self.logdir)
-
- # because solaris tar can't gzip we do the tar and gzip as
- # separate steps.
- tarfile = self.tardir + '.tar'
- tarcmd = ['tar', '-cf', tarfile];
- tarcmd.extend(os.listdir('.'))
- self.runCmd(tarcmd)
- try:
- self.runCmd(['bzip2', tarfile])
- tarfile = tarfile + '.bz2';
- except:
- pass
- self.runCmd(['cp', tarfile, self.olddir])
- os.chdir(self.tardir)
-
-#================================================================
-coverage = GpCoverage()
-coverage.start()
-
-try:
- d = GPDetective()
- try:
- d.copyLogs()
- d.filespaceFlatFiles()
- d.systemInfo()
- if d.runconnected == True:
- d.checkCatalog()
- if d.runcore == True:
- d.crashReport()
- d.finishup()
- except Exception, e:
- print 'ERROR: %s' % e
- print " details: %s" % traceback.format_exc()
- d.error = e
- d.finishup()
- exit(1)
-except Exception, e:
- print "ERROR:"
- print " Unhandled internal error:" + str(e)
- print traceback.format_exc()
- exit(1)
-finally:
- coverage.stop()
- coverage.generate_report()
-
-exit(0);
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/bin/gpfaultinjector
----------------------------------------------------------------------
diff --git a/tools/bin/gpfaultinjector b/tools/bin/gpfaultinjector
deleted file mode 100755
index afb7cda..0000000
--- a/tools/bin/gpfaultinjector
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (c) Greenplum Inc 2010. All Rights Reserved.
-#
-#
-# THIS IMPORT MUST COME FIRST
-# import mainUtils FIRST to get python version check
-#
-from gppylib.mainUtils import *
-
-# now reset of imports
-from gppylib.programs.clsInjectFault import *
-
-#-------------------------------------------------------------------------
-if __name__ == '__main__':
- simple_main( GpInjectFaultProgram.createParser, GpInjectFaultProgram.createProgram)
-
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/bin/gpload.py
----------------------------------------------------------------------
diff --git a/tools/bin/gpload.py b/tools/bin/gpload.py
index 46de4dd..1b1fe70 100755
--- a/tools/bin/gpload.py
+++ b/tools/bin/gpload.py
@@ -1115,8 +1115,8 @@ class gpload:
seenv = False
seenq = False
- # default to gpAdminLogs for a log file, may be overwritten
- self.options.l = os.path.join(os.environ.get('HOME', '.'),'gpAdminLogs')
+ # default to hawqAdminLogs for a log file, may be overwritten
+ self.options.l = os.path.join(os.environ.get('HOME', '.'),'hawqAdminLogs')
if not os.path.isdir(self.options.l):
os.mkdir(self.options.l)
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/bin/gppylib/gplog.py
----------------------------------------------------------------------
diff --git a/tools/bin/gppylib/gplog.py b/tools/bin/gppylib/gplog.py
index 110fc83..b8cf62a 100644
--- a/tools/bin/gppylib/gplog.py
+++ b/tools/bin/gppylib/gplog.py
@@ -89,7 +89,7 @@ def setup_hawq_tool_logging(appName,hostname,userName,logdir=None,nonuser=False)
"""
Returns a singleton logger for standard Greenplum tools:
- Logs output to stdout
- - Logs output to a file, typically in ~/gpAdminLogs
+ - Logs output to a file, typically in ~/hawqAdminLogs
"""
global _DEFAULT_FORMATTER
global _APP_NAME_FOR_DEFAULT_FORMAT
@@ -117,7 +117,7 @@ def setup_tool_logging(appName,hostname,userName,logdir=None,nonuser=False):
"""
Returns a singleton logger for standard Greenplum tools:
- Logs output to stdout
- - Logs output to a file, typically in ~/gpAdminLogs
+ - Logs output to a file, typically in ~/hawqAdminLogs
"""
global _DEFAULT_FORMATTER
global _APP_NAME_FOR_DEFAULT_FORMAT
@@ -280,7 +280,7 @@ def _get_literal_formatter():
def _enable_hawqadmin_logging(name,logdir=None):
"""
Sets up the file output handler for the default logger.
- - if logdir is not specified it uses ~/gpAdminLogs
+ - if logdir is not specified it uses ~/hawqAdminLogs
- the file is constructed as appended with "<logdir>/<name>_<date>.log"
NOTE: internal use only
@@ -310,7 +310,7 @@ def _enable_hawqadmin_logging(name,logdir=None):
def _enable_gpadmin_logging(name,logdir=None):
"""
Sets up the file output handler for the default logger.
- - if logdir is not specified it uses ~/gpAdminLogs
+ - if logdir is not specified it uses ~/hawqAdminLogs
- the file is constructed as appended with "<logdir>/<name>_<date>.log"
NOTE: internal use only
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/bin/gpverify
----------------------------------------------------------------------
diff --git a/tools/bin/gpverify b/tools/bin/gpverify
deleted file mode 100755
index e176c46..0000000
--- a/tools/bin/gpverify
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env python
-
-from gppylib.mainUtils import simple_main
-from gppylib.programs.verify import GpVerifyProgram
-
-#-------------------------------------------------------------------------
-if __name__ == '__main__':
- simple_main(GpVerifyProgram.createParser, GpVerifyProgram)
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3691f236/tools/bin/lib/gp_bash_functions.sh
----------------------------------------------------------------------
diff --git a/tools/bin/lib/gp_bash_functions.sh b/tools/bin/lib/gp_bash_functions.sh
index 182591a..6376108 100755
--- a/tools/bin/lib/gp_bash_functions.sh
+++ b/tools/bin/lib/gp_bash_functions.sh
@@ -1970,7 +1970,7 @@ UPDATE_MPP () {
# Setup logging directory
#******************************************************************************
CUR_DATE=`$DATE +%Y%m%d`
-DEFLOGDIR=$HOME/gpAdminLogs
+DEFLOGDIR=$HOME/hawqAdminLogs
if [ ! -d $DEFLOGDIR ]; then
mkdir $DEFLOGDIR
fi