From b07043fd5154d507b173059c8fd889c4e484b140 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Wed, 9 Dec 2015 15:53:56 +0400 Subject: [PATCH] MDEV-8178 - Wrong progress report for operations on InnoDB tables Correct InnoDB calls to progress report API: - second argument of thd_progress_init() is number of stages, one stage is enough for the row merge - third argument of thd_progress_report() is some value indicating threshold, for the row merge it is file->offset - second argument of thd_progress_report() is some value indicating current state, for the row merge it is file->offset - num_runs. --- storage/innobase/row/row0merge.cc | 7 ++----- storage/xtradb/row/row0merge.cc | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index 75aa423b2ac..3cf86c3d358 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -2304,7 +2304,6 @@ row_merge_sort( { const ulint half = file->offset / 2; ulint num_runs; - ulint cur_run = 0; ulint* run_offset; dberr_t error = DB_SUCCESS; DBUG_ENTER("row_merge_sort"); @@ -2328,18 +2327,16 @@ row_merge_sort( of file marker). Thus, it must be at least one block. */ ut_ad(file->offset > 0); - thd_progress_init(trx->mysql_thd, num_runs); + thd_progress_init(trx->mysql_thd, 1); /* Merge the runs until we have one big run */ do { - cur_run++; - error = row_merge(trx, dup, file, block, tmpfd, &num_runs, run_offset); /* Report progress of merge sort to MySQL for show processlist progress field */ - thd_progress_report(trx->mysql_thd, cur_run, num_runs); + thd_progress_report(trx->mysql_thd, file->offset - num_runs, file->offset); if (error != DB_SUCCESS) { break; diff --git a/storage/xtradb/row/row0merge.cc b/storage/xtradb/row/row0merge.cc index 3447d15ed1c..12c38fdfc2f 100644 --- a/storage/xtradb/row/row0merge.cc +++ b/storage/xtradb/row/row0merge.cc @@ -2312,7 +2312,6 @@ row_merge_sort( { const ulint half = file->offset / 2; ulint num_runs; - ulint cur_run = 0; ulint* run_offset; dberr_t error = DB_SUCCESS; DBUG_ENTER("row_merge_sort"); @@ -2336,18 +2335,16 @@ row_merge_sort( of file marker). Thus, it must be at least one block. */ ut_ad(file->offset > 0); - thd_progress_init(trx->mysql_thd, num_runs); + thd_progress_init(trx->mysql_thd, 1); /* Merge the runs until we have one big run */ do { - cur_run++; - error = row_merge(trx, dup, file, block, tmpfd, &num_runs, run_offset); /* Report progress of merge sort to MySQL for show processlist progress field */ - thd_progress_report(trx->mysql_thd, cur_run, num_runs); + thd_progress_report(trx->mysql_thd, file->offset - num_runs, file->offset); if (error != DB_SUCCESS) { break;