Skip to content

Commit b07043f

Browse files
committed
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.
1 parent d289ba8 commit b07043f

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

storage/innobase/row/row0merge.cc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2304,7 +2304,6 @@ row_merge_sort(
23042304
{
23052305
const ulint half = file->offset / 2;
23062306
ulint num_runs;
2307-
ulint cur_run = 0;
23082307
ulint* run_offset;
23092308
dberr_t error = DB_SUCCESS;
23102309
DBUG_ENTER("row_merge_sort");
@@ -2328,18 +2327,16 @@ row_merge_sort(
23282327
of file marker). Thus, it must be at least one block. */
23292328
ut_ad(file->offset > 0);
23302329

2331-
thd_progress_init(trx->mysql_thd, num_runs);
2330+
thd_progress_init(trx->mysql_thd, 1);
23322331

23332332
/* Merge the runs until we have one big run */
23342333
do {
2335-
cur_run++;
2336-
23372334
error = row_merge(trx, dup, file, block, tmpfd,
23382335
&num_runs, run_offset);
23392336

23402337
/* Report progress of merge sort to MySQL for
23412338
show processlist progress field */
2342-
thd_progress_report(trx->mysql_thd, cur_run, num_runs);
2339+
thd_progress_report(trx->mysql_thd, file->offset - num_runs, file->offset);
23432340

23442341
if (error != DB_SUCCESS) {
23452342
break;

storage/xtradb/row/row0merge.cc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2312,7 +2312,6 @@ row_merge_sort(
23122312
{
23132313
const ulint half = file->offset / 2;
23142314
ulint num_runs;
2315-
ulint cur_run = 0;
23162315
ulint* run_offset;
23172316
dberr_t error = DB_SUCCESS;
23182317
DBUG_ENTER("row_merge_sort");
@@ -2336,18 +2335,16 @@ row_merge_sort(
23362335
of file marker). Thus, it must be at least one block. */
23372336
ut_ad(file->offset > 0);
23382337

2339-
thd_progress_init(trx->mysql_thd, num_runs);
2338+
thd_progress_init(trx->mysql_thd, 1);
23402339

23412340
/* Merge the runs until we have one big run */
23422341
do {
2343-
cur_run++;
2344-
23452342
error = row_merge(trx, dup, file, block, tmpfd,
23462343
&num_runs, run_offset);
23472344

23482345
/* Report progress of merge sort to MySQL for
23492346
show processlist progress field */
2350-
thd_progress_report(trx->mysql_thd, cur_run, num_runs);
2347+
thd_progress_report(trx->mysql_thd, file->offset - num_runs, file->offset);
23512348

23522349
if (error != DB_SUCCESS) {
23532350
break;

0 commit comments

Comments
 (0)