On Mon, 15 Nov 2021 at 15:43, Sergei Golubchik <serg@mariadb.org> wrote:
Hi, Nikita!

On Nov 15, Nikita Malyavin wrote:
> revision-id: f3603cbfaeb (mariadb-10.5.2-483-gf3603cbfaeb)
> parent(s): 3b6038bee88
> author: Nikita Malyavin
> committer: Nikita Malyavin
> timestamp: 2021-01-29 03:47:52 +1000
> message:
>
> report progress

Perhaps, squash this with your commit "test progress reporting" ?

 sure, after the review.
 

> diff --git a/sql/sql_table.cc b/sql/sql_table.cc
> index 29d0f487303..87dbe226c2e 100644
> --- a/sql/sql_table.cc
> +++ b/sql/sql_table.cc
> @@ -11300,6 +11300,9 @@ static int online_alter_read_from_binlog(THD *thd, rpl_group_info *rgi,

>    IO_CACHE *log_file= log->flip();

> +  thd_progress_report(thd, 0, my_b_write_tell(log_file)
> +                             / rgi->tables_to_lock->m_conv_table->s->reclength);

1. why do you do this "/ rgi->...->s->reclength" ?

The idea was to write an approximate number of rows. I think it can come in handy.
 
2. How does it work with your "cache flipping"? While data is copied
between tables, concurrent connections write into an IO_CACHE.
Then you flip, they what, write into the second IO_CACHE?
What file length will you use here in thd_progress_report()?

Should start from zero again.. I dont't see the stage change there, maybe I wasn't sure should it be another stage or the same one.

Also, I see that result in another commit is wrong. Will fix soon,
>SELECT progress from INFORMATION_SCHEMA.PROCESSLIST where id = 4;
returns empty result set. Maybe id is not always 4.
> +
>    do
>    {
>      const auto *descr_event= rgi->rli->relay_log.description_event_for_exec;
> @@ -11319,6 +11322,9 @@ static int online_alter_read_from_binlog(THD *thd, rpl_group_info *rgi,
>      free_root(&event_mem_root, MYF(MY_KEEP_PREALLOC));
>      if (ev != rgi->rli->relay_log.description_event_for_exec)
>        delete ev;
> +    thd_progress_report(thd, my_b_tell(log_file)
> +                             / rgi->tables_to_lock->m_conv_table->s->reclength,
> +                        thd->progress.max_counter);
>    }
>    while(!error);

Regards,
Sergei
VP of MariaDB Server Engineering
and security@mariadb.org


--
Yours truly,
Nikita Malyavin