From 22884d453232e693c008b46977e908ef1d0b5e0d Mon Sep 17 00:00:00 2001 From: Marbin Tan Date: Wed, 24 May 2017 13:14:00 -0700 Subject: [PATCH] Fix gpexpand misreporting re-distributed table. When gpexpand is run with a specific duration or end-time using '-d' or '-e' flag, there might be an off-chance that gpexpand reports that the re-distribute was successful, however, that's not the case. gpexpand status details reports as COMPLETED, but the data has not been redistributed and is still distributed by RANDOM. Signed-off-by: Nadeem Ghani Signed-off-by: Tushar Dadlani --- gpMgmt/bin/gpexpand | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gpMgmt/bin/gpexpand b/gpMgmt/bin/gpexpand index 57ec9aba67..119af75e0e 100755 --- a/gpMgmt/bin/gpexpand +++ b/gpMgmt/bin/gpexpand @@ -2240,10 +2240,10 @@ UPDATE gp_distribution_policy while not self.queue.isDone(): logger.debug( "woke up. queue: %d finished %d " % (self.queue.num_assigned, self.queue.completed_queue.qsize())) - time.sleep(5) if stopTime and datetime.datetime.now() >= stopTime: stoppedEarly = True break + time.sleep(5) expansionStopped = datetime.datetime.now() @@ -2552,6 +2552,11 @@ class ExpandTable(): dbconn.execSQL(table_conn, sql) table_conn.commit() + return True + + # I can only get here if the cancel flag is True + return False + def mark_finished(self, status_conn, start_time, finish_time): sql = """UPDATE %s.%s SET status = '%s', expansion_started='%s', expansion_finished='%s' @@ -2725,8 +2730,8 @@ class ExpandCommand(SQLCommand): if not options.simple_progress: self.table.mark_started(status_conn, table_conn, start_time, self.cancel_flag) - self.table.expand(table_conn, self.cancel_flag) - table_exp_success = True + table_exp_success = self.table.expand(table_conn, self.cancel_flag) + except Exception, ex: if ex.__str__().find('canceling statement due to user request') == -1 and not self.cancel_flag: table_expand_error = True -- GitLab