From 5eaa5889d680c7f00703bcc8a8b5d50f84e5fc49 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Thu, 11 Jan 2018 19:37:03 +0200 Subject: [PATCH] Remove gpexpand --novacuum option, and never vacuum the catalogs. The vacuum was causing trouble, see github issue #4298. And it seems pretty pointless or unrelated to gpexpand, anyway. --- gpMgmt/bin/gpexpand | 10 +--- gpMgmt/bin/gppylib/db/catalog.py | 47 ------------------- .../db/test/regress/test_regress_catalog.py | 5 -- gpMgmt/bin/gppylib/db/test/test_catalog.py | 5 -- .../admin_utilities/gpexpand.xml | 6 +-- 5 files changed, 2 insertions(+), 71 deletions(-) diff --git a/gpMgmt/bin/gpexpand b/gpMgmt/bin/gpexpand index 9187a05229..4d97807d0e 100755 --- a/gpMgmt/bin/gpexpand +++ b/gpMgmt/bin/gpexpand @@ -120,8 +120,6 @@ def parseargs(): help='remove the expansion schema.') parser.add_option('-r', '--rollback', action='store_true', help='rollback failed expansion setup.') - parser.add_option('-V', '--novacuum', action='store_true', - help='Do not vacuum catalog tables before creating schema copy.') parser.add_option('-a', '--analyze', action='store_true', help='Analyze the expanded table after redistribution.') parser.add_option('-d', '--duration', type='duration', metavar='[h][:m[:s]]', @@ -634,13 +632,12 @@ class SegmentTemplate: def __init__(self, logger, statusLogger, pool, gparray, masterDataDirectory, - dburl, conn, noVacuumCatalog, tempDir, batch_size, + dburl, conn, tempDir, batch_size, segTarDir='.', schemaTarFile='gpexpand_schema.tar'): self.logger = logger self.statusLogger = statusLogger self.pool = pool self.gparray = gparray - self.noVacuumCatalog = noVacuumCatalog self.tempDir = tempDir self.batch_size = batch_size self.dburl = dburl @@ -702,10 +699,6 @@ class SegmentTemplate: """Creates the schema template that is used by new segments""" self.logger.info('Creating segment template') - if not self.noVacuumCatalog: - self.logger.info('VACUUM FULL on the catalog tables') - catalog.vacuum_catalog(self.dburl, self.conn, full=True, utility=True) - MakeDirectory.local('gpexpand create temp dir', self.tempDir) self._select_src_segment() @@ -1337,7 +1330,6 @@ Set PGDATABASE or use the -D option to specify the correct database to use.""" % masterDataDirectory=self.options.master_data_directory, dburl=self.dburl, conn=self.conn, - noVacuumCatalog=self.options.novacuum, tempDir=self.tempDir, segTarDir=self.options.tardir, batch_size=self.options.batch_size) diff --git a/gpMgmt/bin/gppylib/db/catalog.py b/gpMgmt/bin/gppylib/db/catalog.py index fcaebc47bd..291d04a017 100644 --- a/gpMgmt/bin/gppylib/db/catalog.py +++ b/gpMgmt/bin/gppylib/db/catalog.py @@ -88,50 +88,3 @@ def get_catalogtable_list(conn): finally: if cursor: cursor.close() - - -def vacuum_catalog(dburl,conn,full=False,utility=False): - """ Will use the provided connection to enumerate the list of databases - and then connect to each one in turn and vacuum full all of the - catalog files - - TODO: There are a few tables that are cluster-wide that strictly speaking - don't need to be vacuumed for each database. These are most likely - small and so perhaps isn't worth the added complexity to optimize them. - - WARNING: doing a vacuum full on the catalog requires that - there aren't any users idle in a transaction as they typically - hold catalog share locks. The result is this vacuum will wait forever on - getting the lock. This method is best called when no one else - is connected to the system. Our own connections are typically idle - in transactions and so are especially bad. - """ - dblist = getDatabaseList(conn) - catlist = get_catalogtable_list(conn) - conn.commit() - - for db in dblist: - test_url = copy.deepcopy(dburl) - test_url.pgdb = db[0] - - if db[0] == 'template0' or db[0] == 'postgres': - continue - - vac_conn = dbconn.connect(test_url,utility) - vac_curs = vac_conn.cursor() - vac_curs.execute("COMMIT") - vac_curs.execute("SET CLIENT_MIN_MESSAGES='ERROR'") - for table in catlist: - logger.debug('Vacuuming %s %s' % (db[0],table[0]) ) - - if full: - sql = "VACUUM FULL %s" % table[0] - else: - sql = "VACUUM %s" % table[0] - - vac_curs.execute(sql) - - - vac_curs.execute(sql) - vac_conn.commit() - vac_conn.close() diff --git a/gpMgmt/bin/gppylib/db/test/regress/test_regress_catalog.py b/gpMgmt/bin/gppylib/db/test/regress/test_regress_catalog.py index 9d9e7b08e2..3a8509ffa4 100644 --- a/gpMgmt/bin/gppylib/db/test/regress/test_regress_catalog.py +++ b/gpMgmt/bin/gppylib/db/test/regress/test_regress_catalog.py @@ -30,11 +30,6 @@ class catalogTestCase(unittest.TestCase): self.conn.close() pass - def test_vacuumcatalog(self): - logger.info("test_vacuumcatalog") - catalog.vacuum_catalog(self.dburl,self.conn) - catalog.vacuum_catalog(self.dburl,self.conn,full=True) - #------------------------------- Mainline -------------------------------- if __name__ == '__main__': unittest.main() diff --git a/gpMgmt/bin/gppylib/db/test/test_catalog.py b/gpMgmt/bin/gppylib/db/test/test_catalog.py index 121244cf06..b2296174c1 100644 --- a/gpMgmt/bin/gppylib/db/test/test_catalog.py +++ b/gpMgmt/bin/gppylib/db/test/test_catalog.py @@ -30,11 +30,6 @@ class catalogTestCase(unittest.TestCase): self.conn.close() pass - def test_vacuumcatalog(self): - logger.info("test_vacuumcatalog") - catalog.vacuum_catalog(self.dburl,self.conn) - catalog.vacuum_catalog(self.dburl,self.conn,full=True) - #------------------------------- Mainline -------------------------------- if __name__ == '__main__': unittest.main() diff --git a/gpdb-doc/dita/utility_guide/admin_utilities/gpexpand.xml b/gpdb-doc/dita/utility_guide/admin_utilities/gpexpand.xml index ff834bdcf1..447d84b3bd 100644 --- a/gpdb-doc/dita/utility_guide/admin_utilities/gpexpand.xml +++ b/gpdb-doc/dita/utility_guide/admin_utilities/gpexpand.xml @@ -8,7 +8,7 @@
Synopsis gpexpand [{-f|--hosts-file} hosts_file] -       | {-i|--input} input_file [-B batch_size] [-V|--novacuum] +       | {-i|--input} input_file [-B batch_size]       | {{-d | --duration} hh:mm:ss | {-e|--end} 'YYYY-MM-DD hh:mm:ss'} [-a|-analyze]          [-n parallel_processes] @@ -187,10 +187,6 @@ --version Display the utility's version number and exit. - - -V | --novacuum - Do not vacuum catalog tables before creating schema copy. - -? | -h | --help Displays the online help. -- GitLab