提交 5eaa5889 编写于 作者: H Heikki Linnakangas 提交者: Xin Zhang

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.
上级 1bcd8809
......@@ -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)
......
......@@ -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()
......@@ -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()
......@@ -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()
......@@ -8,7 +8,7 @@
<section id="section2">
<title>Synopsis</title>
<codeblock><b>gpexpand</b> [{<b>-f</b>|<b>--hosts-file</b>} <varname>hosts_file</varname>]
       | {<b>-i</b>|<b>--input</b>} <varname>input_file</varname> [<b>-B</b> <varname>batch_size</varname>] [<b>-V</b>|<b>--novacuum</b>]
       | {<b>-i</b>|<b>--input</b>} <varname>input_file</varname> [<b>-B</b> <varname>batch_size</varname>]
      | {{<b>-d</b> | <b>--duration</b>} <varname>hh:mm:ss</varname> | {<b>-e</b>|<b>--end</b>} '<varname>YYYY-MM-DD hh:mm:ss</varname>'}
[<b>-a</b>|<b>-analyze</b>]
         [<b>-n </b> <varname>parallel_processes</varname>]
......@@ -187,10 +187,6 @@
<pt>--version</pt>
<pd>Display the utility's version number and exit.</pd>
</plentry>
<plentry>
<pt>-V | --novacuum</pt>
<pd>Do not vacuum catalog tables before creating schema copy.</pd>
</plentry>
<plentry>
<pt>-? | -h | --help</pt>
<pd>Displays the online help.</pd>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册