slow XtraDB shutdown due to 10 second sleep in purge thread
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
Low
|
Kristian Nielsen | ||
Percona Server moved to https://jira.percona.com/projects/PS |
Fix Released
|
Low
|
Alexey Kopytov |
Bug Description
Shutting down XtraDB can take up to 10 seconds, even when there is no actual
work to do during shutdown.
An easy way to see this is to run a quick innodb test in the mysql-test-run.pl
test suite:
./mtr innodb-consistent
This takes >10 seconds, even though the actual test runs instantaneous.
The problem is this code in srv/srv0srv.c:
srv_
{
ulint sleep_ms= 10000; /* initial: 10 sec. */
...
loop:
if (srv_shutdown_state > 0) {
...
}
...
goto loop;
So right after startup, the purge thread sleeps for 10 seconds, so server
cannot shut down for at least 10 seconds after startup.
Of course, in a production server, the purge thread sleep could have adjusted
itself to less than 10 seconds, and a busy server anyway will probably need
much more than 10 seconds to shut down cleanly.
But for development and testing, it is annoying to have to wait for 10 seconds
for shutdown.
Suggested fix:
Change the os_thread_sleep() into a sleep that can be interrupted by
shutdown. For example a wait with os_event_
specifically for this. (Note that currently os_event_
infinitely on non-windows, but it looks easy to fix this using
pthread_
during server shutdown.
Related branches
- Vadim Tkachenko: Approve
- Fred Linhoss (community): Approve (documentation)
-
Diff: 248 lines (+236/-0)2 files modifiedinnodb_fast_shutdown.patch (+235/-0)
series (+1/-0)
Changed in percona-server: | |
status: | New → Confirmed |
importance: | Undecided → Low |
assignee: | nobody → Alexey Kopytov (akopytov) |
milestone: | none → 5.1-13.0 |
Changed in percona-server: | |
status: | Confirmed → Fix Committed |
Changed in maria: | |
milestone: | none → 5.1 |
Changed in percona-server: | |
status: | Fix Committed → Fix Released |
Changed in maria: | |
status: | Fix Committed → Fix Released |
Work-around: --innodb- fast-shutdown= 2, if that is acceptable (which it probably often is during test/development).