Commit b07043fd authored by Sergey Vojtovich's avatar Sergey Vojtovich

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.
parent d289ba80
...@@ -2304,7 +2304,6 @@ row_merge_sort( ...@@ -2304,7 +2304,6 @@ row_merge_sort(
{ {
const ulint half = file->offset / 2; const ulint half = file->offset / 2;
ulint num_runs; ulint num_runs;
ulint cur_run = 0;
ulint* run_offset; ulint* run_offset;
dberr_t error = DB_SUCCESS; dberr_t error = DB_SUCCESS;
DBUG_ENTER("row_merge_sort"); DBUG_ENTER("row_merge_sort");
...@@ -2328,18 +2327,16 @@ row_merge_sort( ...@@ -2328,18 +2327,16 @@ row_merge_sort(
of file marker). Thus, it must be at least one block. */ of file marker). Thus, it must be at least one block. */
ut_ad(file->offset > 0); 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 */ /* Merge the runs until we have one big run */
do { do {
cur_run++;
error = row_merge(trx, dup, file, block, tmpfd, error = row_merge(trx, dup, file, block, tmpfd,
&num_runs, run_offset); &num_runs, run_offset);
/* Report progress of merge sort to MySQL for /* Report progress of merge sort to MySQL for
show processlist progress field */ 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) { if (error != DB_SUCCESS) {
break; break;
......
...@@ -2312,7 +2312,6 @@ row_merge_sort( ...@@ -2312,7 +2312,6 @@ row_merge_sort(
{ {
const ulint half = file->offset / 2; const ulint half = file->offset / 2;
ulint num_runs; ulint num_runs;
ulint cur_run = 0;
ulint* run_offset; ulint* run_offset;
dberr_t error = DB_SUCCESS; dberr_t error = DB_SUCCESS;
DBUG_ENTER("row_merge_sort"); DBUG_ENTER("row_merge_sort");
...@@ -2336,18 +2335,16 @@ row_merge_sort( ...@@ -2336,18 +2335,16 @@ row_merge_sort(
of file marker). Thus, it must be at least one block. */ of file marker). Thus, it must be at least one block. */
ut_ad(file->offset > 0); 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 */ /* Merge the runs until we have one big run */
do { do {
cur_run++;
error = row_merge(trx, dup, file, block, tmpfd, error = row_merge(trx, dup, file, block, tmpfd,
&num_runs, run_offset); &num_runs, run_offset);
/* Report progress of merge sort to MySQL for /* Report progress of merge sort to MySQL for
show processlist progress field */ 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) { if (error != DB_SUCCESS) {
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment