diff --git a/gpMgmt/bin/gpexpand b/gpMgmt/bin/gpexpand index 16f8a61d1ccdfe85e0f27421f17a0012f479be14..42d5746f8edf7b81f5db2256cd456a578fff5cef 100755 --- a/gpMgmt/bin/gpexpand +++ b/gpMgmt/bin/gpexpand @@ -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') diff --git a/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py b/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py index acc8ac8afcf8f6ee41cabb65deb67d66cf8e498c..378540c095e314cb6f875fefc788200c53aa5d16 100644 --- a/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py +++ b/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py @@ -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):