← Back to team overview

maria-developers team mailing list archive

Re: How to report progress for InnoDB background tasks (esp. at startup/shutdown)?

 

Hi, Marko!

On Apr 07, Marko Mäkelä wrote:
> Hi all,
> 
> MariaDB Server features a nice-looking interface for reporting progress on
> long-running SQL operations:
> https://mariadb.com/kb/en/mariadb/progress-reporting/
> 
> MySQL 5.7 implemented something similar for reporting progress for ALTER
> TABLE…ALGORITHM=INPLACE. I should reimplement that for MariaDB using the
> existing MariaDB infrastructure.
> 
> I wonder if the same interface could be used for tracking progress on
> periodic background tasks that might not be directly related to the
> execution of any SQL statements. InnoDB has a number of background tasks,
> such as:
> * purging unneeded history (removing undo log records and delete-marked
> index records)
> * rolling back recovered transactions (mainly, if the server was killed)
> * index defragmentation, encryption key rotation
> * redo log checkpoints (flush all dirty pages up to the checkpoint LSN;
> most interesting at shutdown)

Yes and no. InnoDB background threads can report the progress. They'll
need a THD for that. Luckily, purge threads already have it in 10.2.
The progress will be shown in SHOW PROCESSLIST, but won't be sent
to a client in special progress report packets.

I suspect it should be fairly easy to start using progress reporting in
purge threads. And then you could see whether it makes sense to enable
it for more background threads.

> Related to this, I wonder if it is possible or feasible to change the
> SQL layer logic so that at shutdown, it will not issue ROLLBACK (as
> part of KILL QUERY) to the currently active connections, but let the
> subsequent startup do the rollback in the background. This should
> allow faster shutdowns and restarts.

I don't see why not. From the user point of view an aborted (with a
shutdown or a disconnect) transaction should always be rolled back. But
how exactly it's implemented is up to us, as long as the user visible
behavior stays the same.

Regards,
Sergei
Chief Architect MariaDB
and security@xxxxxxxxxxx


Follow ups

References