hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [3/3] incubator-hawq git commit: HAWQ-158. Remove legacy command line tools and help.
Date Sat, 14 Nov 2015 07:41:41 GMT
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 <rlei@pivotal.io>
Authored: Sat Nov 14 11:18:41 2015 +0800
Committer: rlei <rlei@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


Mime
View raw message