未验证 提交 018525e4 编写于 作者: J Jialun 提交者: GitHub

Fix gpexpand: start new mirror segments after expansion. (#5773)

We found gpexpand on master does not start new mirror segments after expansion, and the status of new mirrors are marked as down in gp_segment_configuration. Because the function sync_new_mirrors has been removed in commit 28eec592. And the test cases do not cover status check. So we re-add this function and add status check in test cases.
上级 745201ea
......@@ -1749,6 +1749,13 @@ Set PGDATABASE or use the -D option to specify the correct database to use.""" %
if restore_conn != None:
restore_conn.close()
def sync_new_mirrors(self):
""" This method will execute gprecoverseg so that all new segments sync with their mirrors."""
if self.gparray.get_mirroring_enabled():
self.logger.info('Starting new mirror segment synchronization')
cmd = GpRecoverSeg(name="gpexpand syncing mirrors", options="-a -F")
cmd.run(validateAfter=True)
def start_prepare(self):
"""Inserts into gpexpand.status that expansion preparation has started."""
if self.options.filename:
......@@ -2860,7 +2867,7 @@ def main(options, args, parser):
_gp_expand.prepare_schema()
logger.info('Starting Greenplum Database')
GpStart.local('gpexpand expansion prepare final start')
# When the mirrors come up, it should sync with the primary on its own.
_gp_expand.sync_new_mirrors()
logger.info('************************************************')
logger.info('Initialization of the system expansion complete.')
logger.info('To begin table expansion onto the new segments')
......
......@@ -2089,7 +2089,7 @@ def impl(context):
def impl(context, num_of_segments):
dbname = 'gptest'
with dbconn.connect(dbconn.DbURL(dbname=dbname)) as conn:
query = """SELECT count(*) from gp_segment_configuration where -1 < content"""
query = """SELECT count(*) from gp_segment_configuration where -1 < content and status = 'u'"""
end_data_segments = dbconn.execSQLForSingleton(conn, query)
if int(num_of_segments) == int(end_data_segments - context.start_data_segments):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册