Commit fc31e311 authored by Jan Lindström's avatar Jan Lindström

MDEV-8179: Absent progress report for operations on InnoDB tables

Add progress info on InnoDB/XtraDB row0merge phase. Note that we
do not know exact number of rounds merge sort needs at start thus
also progress report might not be accurate.
parent 36bf482d
...@@ -2216,6 +2216,7 @@ row_merge( ...@@ -2216,6 +2216,7 @@ row_merge(
/* Copy the last blocks, if there are any. */ /* Copy the last blocks, if there are any. */
while (foffs0 < ihalf) { while (foffs0 < ihalf) {
if (UNIV_UNLIKELY(trx_is_interrupted(trx))) { if (UNIV_UNLIKELY(trx_is_interrupted(trx))) {
return(DB_INTERRUPTED); return(DB_INTERRUPTED);
} }
...@@ -2232,6 +2233,7 @@ row_merge( ...@@ -2232,6 +2233,7 @@ row_merge(
ut_ad(foffs0 == ihalf); ut_ad(foffs0 == ihalf);
while (foffs1 < file->offset) { while (foffs1 < file->offset) {
if (trx_is_interrupted(trx)) { if (trx_is_interrupted(trx)) {
return(DB_INTERRUPTED); return(DB_INTERRUPTED);
} }
...@@ -2291,6 +2293,7 @@ row_merge_sort( ...@@ -2291,6 +2293,7 @@ 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");
...@@ -2314,11 +2317,19 @@ row_merge_sort( ...@@ -2314,11 +2317,19 @@ 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);
/* 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
show processlist progress field */
thd_progress_report(trx->mysql_thd, cur_run, num_runs);
if (error != DB_SUCCESS) { if (error != DB_SUCCESS) {
break; break;
} }
...@@ -2328,6 +2339,8 @@ row_merge_sort( ...@@ -2328,6 +2339,8 @@ row_merge_sort(
mem_free(run_offset); mem_free(run_offset);
thd_progress_end(trx->mysql_thd);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
......
...@@ -2105,6 +2105,7 @@ row_merge( ...@@ -2105,6 +2105,7 @@ row_merge(
/* Copy the last blocks, if there are any. */ /* Copy the last blocks, if there are any. */
while (foffs0 < ihalf) { while (foffs0 < ihalf) {
if (UNIV_UNLIKELY(trx_is_interrupted(trx))) { if (UNIV_UNLIKELY(trx_is_interrupted(trx))) {
return(DB_INTERRUPTED); return(DB_INTERRUPTED);
} }
...@@ -2121,6 +2122,7 @@ row_merge( ...@@ -2121,6 +2122,7 @@ row_merge(
ut_ad(foffs0 == ihalf); ut_ad(foffs0 == ihalf);
while (foffs1 < file->offset) { while (foffs1 < file->offset) {
if (trx_is_interrupted(trx)) { if (trx_is_interrupted(trx)) {
return(DB_INTERRUPTED); return(DB_INTERRUPTED);
} }
...@@ -2180,6 +2182,7 @@ row_merge_sort( ...@@ -2180,6 +2182,7 @@ 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");
...@@ -2203,11 +2206,19 @@ row_merge_sort( ...@@ -2203,11 +2206,19 @@ 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);
/* 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
show processlist progress field */
thd_progress_report(trx->mysql_thd, cur_run, num_runs);
if (error != DB_SUCCESS) { if (error != DB_SUCCESS) {
break; break;
} }
...@@ -2217,6 +2228,8 @@ row_merge_sort( ...@@ -2217,6 +2228,8 @@ row_merge_sort(
mem_free(run_offset); mem_free(run_offset);
thd_progress_end(trx->mysql_thd);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
......
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